[PureACL] NEON implicit CONV2D operation (#2356)
author윤현식/동작제어Lab(SR)/Principal Engineer/삼성전자 <hyunsik.yoon@samsung.com>
Wed, 22 Aug 2018 10:03:30 +0000 (19:03 +0900)
committer박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Wed, 22 Aug 2018 10:03:30 +0000 (19:03 +0900)
Added NEON implicit CONV2D operation.
From 20 `conv` generated tests, 6 tests passes.

```
$ NEON=1 LD_LIBRARY_PATH=Product/out/lib Product/out/unittest/runtime_run_android_nn_test --gtest_filter=GeneratedTests.conv*

[==========] Running 20 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 20 tests from GeneratedTests
[       OK ] GeneratedTests.conv_1_h3_w2_SAME (51 ms)
[       OK ] GeneratedTests.conv_1_h3_w2_VALID (3 ms)
[       OK ] GeneratedTests.conv_3_h3_w2_SAME (10 ms)
[       OK ] GeneratedTests.conv_3_h3_w2_VALID (7 ms)
[       OK ] GeneratedTests.conv_float_2 (2 ms)
[       OK ] GeneratedTests.conv_quant8_2 (3 ms)
[==========] 20 tests from 1 test case ran. (86 ms total)
[  PASSED  ] 6 tests.

[  FAILED  ] GeneratedTests.conv_float_channels
[  FAILED  ] GeneratedTests.conv_float_channels_weights_as_inputs
[  FAILED  ] GeneratedTests.conv_float_large
[  FAILED  ] GeneratedTests.conv_float_large_weights_as_inputs
[  FAILED  ] GeneratedTests.conv_float
[  FAILED  ] GeneratedTests.conv_float_weights_as_inputs
[  FAILED  ] GeneratedTests.conv_quant8_channels
[  FAILED  ] GeneratedTests.conv_quant8_channels_weights_as_inputs
[  FAILED  ] GeneratedTests.conv_quant8_large
[  FAILED  ] GeneratedTests.conv_quant8_large_weights_as_inputs
[  FAILED  ] GeneratedTests.conv_quant8
[  FAILED  ] GeneratedTests.conv_quant8_overflow
[  FAILED  ] GeneratedTests.conv_quant8_overflow_weights_as_inputs
[  FAILED  ] GeneratedTests.conv_quant8_weights_as_inputs

14 FAILED TESTS
```

Signed-off-by: Hyun Sik Yoon <hyunsik.yoon@samsung.com>
runtimes/pure_arm_compute/src/compilation.cc

index e82a870..f4c8413 100644 (file)
@@ -18,6 +18,7 @@
 #include <arm_compute/runtime/CL/functions/CLTopKV2.h>
 #include <arm_compute/runtime/CL/functions/CLReduceMax.h>
 #include <arm_compute/runtime/CL/functions/CLCast.h>
+#include <arm_compute/runtime/CL/functions/CLConvolutionLayer.h>
 #include <arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h>
 #include <arm_compute/runtime/CL/functions/CLDequantizationLayer.h>
 #include <arm_compute/runtime/CL/functions/CLReductionMean.h>
@@ -32,6 +33,7 @@
 #include <arm_compute/runtime/NEON/functions/NEPixelWiseMultiplication.h>
 #include <arm_compute/runtime/NEON/functions/NEPoolingLayer.h>
 #include <arm_compute/runtime/NEON/functions/NEActivationLayer.h>
+#include <arm_compute/runtime/NEON/functions/NEConvolutionLayer.h>
 #include <arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h>
 
 #include "internal/arm_compute.h"
@@ -411,8 +413,6 @@ void ActivationBuilder::append(FuseCode code, ::arm_compute::ITensor *ifm_alloc)
   }
 }
 
-#include <arm_compute/runtime/CL/functions/CLConvolutionLayer.h>
-
 class Planner : public ::internal::tflite::op::NodeVisitor
 {
 public:
@@ -908,7 +908,13 @@ void Planner::visit(const ::internal::tflite::op::Conv2D::Implicit::Node &node)
       builder.append("Conv2D", std::move(fn));
     }
     else
-      throw std::runtime_error("Not supported, yet");
+    {
+      std::unique_ptr<::arm_compute::NEConvolutionLayer> fn{new ::arm_compute::NEConvolutionLayer};
+
+      fn->configure(ifm_alloc, ker_alloc, bias_alloc, ofm_alloc, conv_info);
+
+      builder.append("Conv2D", std::move(fn));
+    }
 
     ActivationBuilder{builder}.append(param.activation, ofm_alloc);
   };