[PureACL] NEON implicit MaxPool2D & AvgPool2D operation (#2361)
author윤현식/동작제어Lab(SR)/Principal Engineer/삼성전자 <hyunsik.yoon@samsung.com>
Mon, 20 Aug 2018 23:33:45 +0000 (08:33 +0900)
committer박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Mon, 20 Aug 2018 23:33:45 +0000 (08:33 +0900)
Added NEON implicit MaxPool2D and AvgPool2D operation.
This commits makes 2 `MaxPool2D` generated test passed among 8 tests
and makes 2 `AvgPool2D` generated test passed among 8 tests

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

[       OK ] GeneratedTests.max_pool_float_4 (42 ms)
[       OK ] GeneratedTests.max_pool_quant8_4 (1 ms)
...
[==========] 8 tests from 1 test case ran. (51 ms total)
[  PASSED  ] 2 tests.
[  FAILED  ] 6 tests, listed below:
[  FAILED  ] GeneratedTests.max_pool_float_1
[  FAILED  ] GeneratedTests.max_pool_float_2
[  FAILED  ] GeneratedTests.max_pool_float_3
[  FAILED  ] GeneratedTests.max_pool_quant8_1
[  FAILED  ] GeneratedTests.max_pool_quant8_2
[  FAILED  ] GeneratedTests.max_pool_quant8_3

```

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

[       OK ] GeneratedTests.avg_pool_float_5 (42 ms)
[       OK ] GeneratedTests.avg_pool_quant8_5 (1 ms)
...
[==========] 10 tests from 1 test case ran. (50 ms total)
[  PASSED  ] 2 tests.
[  FAILED  ] 8 tests, listed below:
[  FAILED  ] GeneratedTests.avg_pool_float_1
[  FAILED  ] GeneratedTests.avg_pool_float_2
[  FAILED  ] GeneratedTests.avg_pool_float_3
[  FAILED  ] GeneratedTests.avg_pool_float_4
[  FAILED  ] GeneratedTests.avg_pool_quant8_1
[  FAILED  ] GeneratedTests.avg_pool_quant8_2
[  FAILED  ] GeneratedTests.avg_pool_quant8_3
[  FAILED  ] GeneratedTests.avg_pool_quant8_4

```

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

index 63834c5..5bf9f9f 100644 (file)
@@ -26,6 +26,7 @@
 #include <arm_compute/runtime/NEON/functions/NEArithmeticAddition.h>
 #include <arm_compute/runtime/NEON/functions/NEArithmeticSubtraction.h>
 #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 "internal/arm_compute.h"
@@ -1497,7 +1498,13 @@ void Planner::visit(const ::internal::tflite::op::MaxPool2D::Implicit::Node &nod
       builder.append("MaxPool2D", std::move(fn));
     }
     else
-      throw std::runtime_error("Not supported, yet");
+    {
+      std::unique_ptr<::arm_compute::NEPoolingLayer> fn{new ::arm_compute::NEPoolingLayer};
+
+      fn->configure(ifm_alloc, ofm_alloc, info);
+
+      builder.append("MaxPool2D", std::move(fn));
+    }
 
     ActivationBuilder{builder}.append(param.activation, ofm_alloc);
   };
@@ -1711,7 +1718,13 @@ void Planner::visit(const ::internal::tflite::op::AvgPool2D::Implicit::Node &nod
       builder.append("AvgPool2D", std::move(fn));
     }
     else
-      throw std::runtime_error("Not supported, yet");
+    {
+      std::unique_ptr<::arm_compute::NEPoolingLayer> fn{new ::arm_compute::NEPoolingLayer};
+
+      fn->configure(ifm_alloc, ofm_alloc, info);
+
+      builder.append("AvgPool2D", std::move(fn));
+    }
 
     ActivationBuilder{builder}.append(param.activation, ofm_alloc);
   };