Fix redundancy in call to configure() in ACL DepthwiseConvolution workloads
authorAron Virginas-Tar <Aron.Virginas-Tar@arm.com>
Thu, 14 Nov 2019 16:21:38 +0000 (16:21 +0000)
committerAron Virginas-Tar <Aron.Virginas-Tar@arm.com>
Thu, 14 Nov 2019 16:41:45 +0000 (16:41 +0000)
Signed-off-by: Aron Virginas-Tar <Aron.Virginas-Tar@arm.com>
Change-Id: I8f698c6ec9826ce1188bc43bd59fbf7b83455c1a

src/backends/cl/workloads/ClDepthwiseConvolutionWorkload.cpp
src/backends/neon/workloads/NeonDepthwiseConvolutionWorkload.cpp

index eb837d7..858eab4 100644 (file)
@@ -114,35 +114,16 @@ ClDepthwiseConvolutionWorkload::ClDepthwiseConvolutionWorkload(
 
     arm_compute::PadStrideInfo padStrideInfo = BuildArmComputePadStrideInfo(m_Data.m_Parameters);
 
-    // Check for optimisation opportunities.
-    bool use3x3Optimisation = (weightInfo.GetShape()[2] == 3) && (weightInfo.GetShape()[3] == 3);
-    if (use3x3Optimisation)
-    {
-        m_DepthwiseConvolutionLayer = std::make_unique<arm_compute::CLDepthwiseConvolutionLayer>();
-        static_cast<arm_compute::CLDepthwiseConvolutionLayer*>(m_DepthwiseConvolutionLayer.get())->configure(
-            &input,
-            m_KernelTensor.get(),
-            m_BiasTensor.get(),
-            &output,
-            padStrideInfo,
-            depthMultiplier,
-            arm_compute::ActivationLayerInfo(),
-            aclDilationInfo);
-    }
-    else
-    {
-        m_DepthwiseConvolutionLayer = std::make_unique<arm_compute::CLDepthwiseConvolutionLayer>();
-        static_cast<arm_compute::CLDepthwiseConvolutionLayer*>(m_DepthwiseConvolutionLayer.get())->configure(
-            &input,
-            m_KernelTensor.get(),
-            m_BiasTensor.get(),
-            &output,
-            padStrideInfo,
-            depthMultiplier,
-            arm_compute::ActivationLayerInfo(),
-            aclDilationInfo);
-
-    }
+    m_DepthwiseConvolutionLayer = std::make_unique<arm_compute::CLDepthwiseConvolutionLayer>();
+    static_cast<arm_compute::CLDepthwiseConvolutionLayer*>(m_DepthwiseConvolutionLayer.get())->configure(
+        &input,
+        m_KernelTensor.get(),
+        m_BiasTensor.get(),
+        &output,
+        padStrideInfo,
+        depthMultiplier,
+        arm_compute::ActivationLayerInfo(),
+        aclDilationInfo);
 
     BOOST_ASSERT(m_DepthwiseConvolutionLayer);
 
index 2093613..f039a6b 100644 (file)
@@ -113,48 +113,16 @@ NeonDepthwiseConvolutionWorkload::NeonDepthwiseConvolutionWorkload(
 
     arm_compute::PadStrideInfo padStrideInfo = BuildArmComputePadStrideInfo(m_Data.m_Parameters);
 
-    const arm_compute::ITensorInfo* inputInfo  = input.info();
-    const arm_compute::ITensorInfo* kernelInfo = m_KernelTensor->info();
-    const arm_compute::ITensorInfo* biasInfo   = m_BiasTensor ? m_BiasTensor->info() : nullptr;
-    const arm_compute::ITensorInfo* outputInfo = output.info();
-
-    // Check for optimisation opportunities
-    arm_compute::Status optimizationStatus =
-        arm_compute::NEDepthwiseConvolutionLayer::validate(inputInfo,
-                                                           kernelInfo,
-                                                           biasInfo,
-                                                           outputInfo,
-                                                           padStrideInfo,
-                                                           depthMultiplier,
-                                                           arm_compute::ActivationLayerInfo(),
-                                                           aclDilationInfo);
-
-    if (optimizationStatus.error_code() == arm_compute::ErrorCode::OK)
-    {
-        m_pDepthwiseConvolutionLayer = std::make_unique<arm_compute::NEDepthwiseConvolutionLayer>();
-        static_cast<arm_compute::NEDepthwiseConvolutionLayer*>(
-            m_pDepthwiseConvolutionLayer.get())->configure(&input,
-                                                           m_KernelTensor.get(),
-                                                           m_BiasTensor.get(),
-                                                           &output,
-                                                           padStrideInfo,
-                                                           depthMultiplier,
-                                                           arm_compute::ActivationLayerInfo(),
-                                                           aclDilationInfo);
-    }
-    else
-    {
-        m_pDepthwiseConvolutionLayer = std::make_unique<arm_compute::NEDepthwiseConvolutionLayer>();
-        static_cast<arm_compute::NEDepthwiseConvolutionLayer*>(
-            m_pDepthwiseConvolutionLayer.get())->configure(&input,
-                                                           m_KernelTensor.get(),
-                                                           m_BiasTensor.get(),
-                                                           &output,
-                                                           padStrideInfo,
-                                                           depthMultiplier,
-                                                           arm_compute::ActivationLayerInfo(),
-                                                           aclDilationInfo);
-    }
+    m_pDepthwiseConvolutionLayer = std::make_unique<arm_compute::NEDepthwiseConvolutionLayer>();
+    static_cast<arm_compute::NEDepthwiseConvolutionLayer*>(
+        m_pDepthwiseConvolutionLayer.get())->configure(&input,
+                                                        m_KernelTensor.get(),
+                                                        m_BiasTensor.get(),
+                                                        &output,
+                                                        padStrideInfo,
+                                                        depthMultiplier,
+                                                        arm_compute::ActivationLayerInfo(),
+                                                        aclDilationInfo);
 
     BOOST_ASSERT(m_pDepthwiseConvolutionLayer);