Apply .FORMATCHECKED to libs (#1215)
author김정현/동작제어Lab(SR)/Senior Engineer/삼성전자 <jh0822.kim@samsung.com>
Tue, 15 May 2018 07:49:16 +0000 (16:49 +0900)
committer서상민/동작제어Lab(SR)/Senior Engineer/삼성전자 <sangmin7.seo@samsung.com>
Tue, 15 May 2018 07:49:16 +0000 (16:49 +0900)
This commit applies format checker to directory `libs`.

Signed-off-by: Junghyun Kim <jh0822.kim@samsung.com>
60 files changed:
libs/.FORMATCHECKED [new file with mode: 0644]
libs/kernel/acl/src/DepthwiseConv2D.h
libs/kernel/acl/src/DepthwiseConv2D.test.h
libs/kernel/acl/src/FullyConnected.h
libs/kernel/acl/src/FullyConnected.test.h
libs/kernel/acl/src/IO_accessor.cpp
libs/kernel/acl/src/IO_accessor.h
libs/kernel/acl/src/Init_acl.cpp
libs/kernel/acl/src/Reshape.h
libs/kernel/acl/src/Reshape.test.h
libs/kernel/acl/src/UniqueTensor.h
libs/kernel/acl/src/cl/Concatenation.cpp
libs/kernel/acl/src/cl/Concatenation.test.cpp
libs/kernel/acl/src/cl/Conv2D.cpp
libs/kernel/acl/src/cl/Conv2D.test.cpp
libs/kernel/acl/src/cl/DepthwiseConv2D.cpp
libs/kernel/acl/src/cl/FullyConnected.cpp
libs/kernel/acl/src/cl/Pooling.cpp
libs/kernel/acl/src/cl/Pooling.test.cpp
libs/kernel/acl/src/cl/Reshape.cpp
libs/kernel/acl/src/cl/Softmax.cpp
libs/kernel/acl/src/cl/Softmax.test.cpp
libs/kernel/acl/src/gtest_env.cpp
libs/kernel/acl/src/neon/Concatenation.cpp
libs/kernel/acl/src/neon/Concatenation.test.cpp
libs/kernel/acl/src/neon/Conv2D.cpp
libs/kernel/acl/src/neon/Conv2D.test.cpp
libs/kernel/acl/src/neon/DepthwiseConv2D.cpp
libs/kernel/acl/src/neon/FullyConnected.cpp
libs/kernel/acl/src/neon/FullyConnected.test.cpp
libs/kernel/acl/src/neon/Pooling.cpp
libs/kernel/acl/src/neon/Pooling.test.cpp
libs/kernel/acl/src/neon/Reshape.cpp
libs/kernel/acl/src/neon/Softmax.cpp
libs/kernel/acl/src/neon/Softmax.test.cpp
libs/kernel/acl/src/shape.cpp
libs/kernel/acl/src/shape.h
libs/kernel/acl/src/support.cpp
libs/kernel/acl/src/support.h
libs/kernel/acl/src/util.cpp
libs/kernel/acl/src/util.h
libs/support/tflite/src/Diff.cpp
libs/support/tflite/src/TensorView.cpp
libs/support/tflite/src/TensorView.test.cpp
libs/util/examples/tensor_index_iterator.cpp
libs/util/include/util/benchmark.h
libs/util/include/util/environment.h
libs/util/include/util/feature/Index.h
libs/util/include/util/feature/Object.h
libs/util/include/util/feature/Shape.h
libs/util/include/util/feature/TextFormatter.h
libs/util/include/util/kernel/RandomObject.h
libs/util/include/util/tensor/Index.h
libs/util/include/util/tensor/Object.h
libs/util/include/util/tensor/Shape.h
libs/util/include/util/tensor/Zipper.h
libs/util/include/util/vector.h
libs/util/include/util/vector/Object.h
libs/util/src/environment.cpp
libs/util/src/tensor/Shape.cpp

diff --git a/libs/.FORMATCHECKED b/libs/.FORMATCHECKED
new file mode 100644 (file)
index 0000000..e69de29
index 8af8d4f..0aa5ee6 100644 (file)
 #include "shape.h"
 #include "IO_accessor.h"
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
-
-namespace common {
-
-typedef std::function<void (void)> sync_scheduler_f;
-
-template<class TensorT, class LayerT, class ActT>
-bool depthwiseConvFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
-                          const float* filterData, const nnfw::rt::Shape& filterShape,
-                          const float* biasData, const nnfw::rt::Shape& biasShape,
-                          int32_t padding_left, int32_t padding_right,
-                          int32_t padding_top, int32_t padding_bottom,
-                          int32_t stride_width, int32_t stride_height,
-                          int32_t depth_multiplier, int32_t activation,
-                          float* outputData, const nnfw::rt::Shape& outputShape,
-                          sync_scheduler_f sync_scheduler) {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
+
+namespace common
+{
+
+typedef std::function<void(void)> sync_scheduler_f;
+
+template <class TensorT, class LayerT, class ActT>
+bool depthwiseConvFloat32(const float *inputData, const nnfw::rt::Shape &inputShape,
+                          const float *filterData, const nnfw::rt::Shape &filterShape,
+                          const float *biasData, const nnfw::rt::Shape &biasShape,
+                          int32_t padding_left, int32_t padding_right, int32_t padding_top,
+                          int32_t padding_bottom, int32_t stride_width, int32_t stride_height,
+                          int32_t depth_multiplier, int32_t activation, float *outputData,
+                          const nnfw::rt::Shape &outputShape, sync_scheduler_f sync_scheduler)
+{
   auto inputShapeACL = util::fromNNShape(inputShape);
   auto weightsShapeACL = util::fromNNShape(filterShape);
   auto biasShapeACL = util::fromNNShape(biasShape);
@@ -53,10 +56,9 @@ bool depthwiseConvFloat32(const float* inputData, const nnfw::rt::Shape& inputSh
   TensorT bias(arm_compute::TensorInfo(biasShapeACL, arm_compute::Format::F32));
   TensorT output(arm_compute::TensorInfo(outputShapeACL, arm_compute::Format::F32));
 
-  arm_compute::PadStrideInfo psinfo = arm_compute::PadStrideInfo(stride_width, stride_height,
-                                              padding_left, padding_right,
-                                              padding_top, padding_bottom,
-                                              arm_compute::DimensionRoundingType::FLOOR);
+  arm_compute::PadStrideInfo psinfo = arm_compute::PadStrideInfo(
+      stride_width, stride_height, padding_left, padding_right, padding_top, padding_bottom,
+      arm_compute::DimensionRoundingType::FLOOR);
 
   auto l = std::make_shared<LayerT>();
   l->configure(input.ptr(), weights.ptr(), bias.ptr(), output.ptr(), psinfo);
index b2c8592..b459cd7 100644 (file)
@@ -32,7 +32,8 @@
 
 using namespace nnfw::kernel::acl;
 
-ACL_TEST(KernelACL_TC, dwise_conv2d_1) {
+ACL_TEST(KernelACL_TC, dwise_conv2d_1)
+{
   uint32_t input_n = 1;
   uint32_t input_h = 3;
   uint32_t input_w = 3;
@@ -64,7 +65,7 @@ ACL_TEST(KernelACL_TC, dwise_conv2d_1) {
     uint32_t W = input_w;
     uint32_t C = input_c;
 
-    return n*H*W*C + h*W*C + w*C + c;
+    return n * H * W * C + h * W * C + w * C + c;
   });
   weights.initValue([&](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
     uint32_t N = 1;
@@ -72,35 +73,26 @@ ACL_TEST(KernelACL_TC, dwise_conv2d_1) {
     uint32_t W = filter_w;
     uint32_t C = filter_c;
 
-    return n*H*W*C + h*W*C + w*C + c;
-  });
-  bias.initValue([](uint32_t w) {
-    return 0.f;
-  });
-  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 0.f;
+    return n * H * W * C + h * W * C + w * C + c;
   });
+  bias.initValue([](uint32_t w) { return 0.f; });
+  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 0.f; });
 
-  bool bret = ACL_CORE_FUNC_NAME(input.ptr<float>(), input.shape(),
-      weights.ptr<float>(), weights.shape(),
-      bias.ptr<float>(), bias.shape(),
-      padding_left, padding_right,
-      padding_top, padding_bottom,
-      stride_width, stride_height,
-      depth_multiplier, activation,
-      output.ptr<float>(), output.shape());
+  bool bret = ACL_CORE_FUNC_NAME(
+      input.ptr<float>(), input.shape(), weights.ptr<float>(), weights.shape(), bias.ptr<float>(),
+      bias.shape(), padding_left, padding_right, padding_top, padding_bottom, stride_width,
+      stride_height, depth_multiplier, activation, output.ptr<float>(), output.shape());
 
   EXPECT_EQ(bret, true);
 
   util::TensorWrapper expected({1, out_h, out_w, filter_c});
-  expected.initValue([&](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 204.f;
-  });
+  expected.initValue([&](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 204.f; });
 
   EXPECT_EQ(output, expected);
 }
 
-ACL_TEST(KernelACL_TC, dwise_conv2d_multi_channel) {
+ACL_TEST(KernelACL_TC, dwise_conv2d_multi_channel)
+{
   uint32_t input_n = 1;
   uint32_t input_h = 3;
   uint32_t input_w = 3;
@@ -132,7 +124,7 @@ ACL_TEST(KernelACL_TC, dwise_conv2d_multi_channel) {
     uint32_t W = input_w;
     uint32_t C = input_c;
 
-    return n*H*W*C + h*W*C + w*C + c;
+    return n * H * W * C + h * W * C + w * C + c;
   });
   weights.initValue([&](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
     uint32_t N = 1;
@@ -140,37 +132,26 @@ ACL_TEST(KernelACL_TC, dwise_conv2d_multi_channel) {
     uint32_t W = filter_w;
     uint32_t C = filter_c;
 
-    return n*H*W*C + h*W*C + w*C + c;
-  });
-  bias.initValue([](uint32_t w) {
-    return 0.f;
-  });
-  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 0.f;
+    return n * H * W * C + h * W * C + w * C + c;
   });
+  bias.initValue([](uint32_t w) { return 0.f; });
+  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 0.f; });
 
-  bool bret = ACL_CORE_FUNC_NAME(input.ptr<float>(), input.shape(),
-      weights.ptr<float>(), weights.shape(),
-      bias.ptr<float>(), bias.shape(),
-      padding_left, padding_right,
-      padding_top, padding_bottom,
-      stride_width, stride_height,
-      depth_multiplier, activation,
-      output.ptr<float>(), output.shape());
+  bool bret = ACL_CORE_FUNC_NAME(
+      input.ptr<float>(), input.shape(), weights.ptr<float>(), weights.shape(), bias.ptr<float>(),
+      bias.shape(), padding_left, padding_right, padding_top, padding_bottom, stride_width,
+      stride_height, depth_multiplier, activation, output.ptr<float>(), output.shape());
 
   EXPECT_EQ(bret, true);
 
   util::TensorWrapper expected({1, out_h, out_w, filter_c});
-  expected.initValue({
-    1836.f,
-    2061.f,
-    2304.f
-  });
+  expected.initValue({1836.f, 2061.f, 2304.f});
 
   EXPECT_EQ(output, expected);
 }
 
-ACL_TEST(KernelACL_TC, dwise_conv2d_inception_1) {
+ACL_TEST(KernelACL_TC, dwise_conv2d_inception_1)
+{
   uint32_t input_n = 1;
   uint32_t input_h = 112;
   uint32_t input_w = 112;
@@ -196,48 +177,34 @@ ACL_TEST(KernelACL_TC, dwise_conv2d_inception_1) {
 
   int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU6);
 
-  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return c;
-  });
-  weights.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return c;
-  });
-  bias.initValue([](uint32_t w) {
-    return 0.f;
-  });
-  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 0.f;
-  });
+  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return c; });
+  weights.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return c; });
+  bias.initValue([](uint32_t w) { return 0.f; });
+  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 0.f; });
 
-  bool bret = ACL_CORE_FUNC_NAME(input.ptr<float>(), input.shape(),
-      weights.ptr<float>(), weights.shape(),
-      bias.ptr<float>(), bias.shape(),
-      padding_left, padding_right,
-      padding_top, padding_bottom,
-      stride_width, stride_height,
-      depth_multiplier, activation,
-      output.ptr<float>(), output.shape());
+  bool bret = ACL_CORE_FUNC_NAME(
+      input.ptr<float>(), input.shape(), weights.ptr<float>(), weights.shape(), bias.ptr<float>(),
+      bias.shape(), padding_left, padding_right, padding_top, padding_bottom, stride_width,
+      stride_height, depth_multiplier, activation, output.ptr<float>(), output.shape());
 
   EXPECT_EQ(bret, true);
 
   util::TensorWrapper expected({1, out_h, out_w, filter_c});
   expected.initValue([&](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
     float v = 9.f;
-    if( h == 0 || h == out_h-1 )
+    if (h == 0 || h == out_h - 1)
       v -= 3.f;
-    if( w == 0 || w == out_w-1 )
+    if (w == 0 || w == out_w - 1)
       v -= 3.f;
 
     // four corners
-    if( (w == 0 && h == 0)
-     || (w == 0 && h == out_h-1)
-     || (w == out_w-1 && h == 0)
-     || (w == out_w-1 && h == out_h-1) )
+    if ((w == 0 && h == 0) || (w == 0 && h == out_h - 1) || (w == out_w - 1 && h == 0) ||
+        (w == out_w - 1 && h == out_h - 1))
       v += 1.f;
 
     // Assumption: negative numbers cannot appear because
     // only positive numbers exist in the input and weights.
-    float ret = c*c*v;
+    float ret = c * c * v;
     return std::min(ret, 6.f);
   });
 
index 5030a85..f04f91a 100644 (file)
 #include "shape.h"
 #include "IO_accessor.h"
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
 
-namespace common {
+namespace common
+{
 
-typedef std::function<void (void)> sync_scheduler_f;
+typedef std::function<void(void)> sync_scheduler_f;
 
-template<class TensorT, class LayerT, class ActT>
-bool fullyConnectedFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
-                           const float* weightsData, const nnfw::rt::Shape& weightsShape,
-                           const float* biasData, const nnfw::rt::Shape& biasShape,
-                           int32_t activation,
-                           float* outputData, const nnfw::rt::Shape& outputShape,
-                           sync_scheduler_f sync_scheduler) {
+template <class TensorT, class LayerT, class ActT>
+bool fullyConnectedFloat32(const float *inputData, const nnfw::rt::Shape &inputShape,
+                           const float *weightsData, const nnfw::rt::Shape &weightsShape,
+                           const float *biasData, const nnfw::rt::Shape &biasShape,
+                           int32_t activation, float *outputData,
+                           const nnfw::rt::Shape &outputShape, sync_scheduler_f sync_scheduler)
+{
 
-  // NNAPI specification: https://developer.android.com/ndk/reference/group___neural_networks.html#ggaabbe492c60331b13038e39d4207940e0aaada7a3dbaf4676aba560c933ff610c5
+  // NNAPI specification:
+  // https://developer.android.com/ndk/reference/group___neural_networks.html#ggaabbe492c60331b13038e39d4207940e0aaada7a3dbaf4676aba560c933ff610c5
 
   // According to the NNAPI Specification,
   // INPUT
   // 1. input rank is up to 4.
   // 2. if input rank > 2, it is flattened to rank 2 [batch_size, input_size]
   nnfw::rt::Shape flattenedInputShape = inputShape;
-  switch(inputShape.dimensions.size()) {
-  case 1:
+  switch (inputShape.dimensions.size())
+  {
+    case 1:
     {
       assert("Need to be implemented." && 0);
       break;
     }
-  case 2:
+    case 2:
     {
       // DO NOTHING.
       break;
     }
-  case 3:
+    case 3:
     {
       assert("Need to be implemented." && 0);
       break;
     }
-  case 4:
+    case 4:
     {
       auto N = inputShape.dimensions[0];
       auto H = inputShape.dimensions[1];
       auto W = inputShape.dimensions[2];
       auto C = inputShape.dimensions[3];
-      flattenedInputShape.dimensions = {N, H*W*C};
+      flattenedInputShape.dimensions = {N, H * W * C};
       break;
     }
-  default:
-    assert(inputShape.dimensions.size() <= 4);
+    default:
+      assert(inputShape.dimensions.size() <= 4);
   }
   // Finally, flattenedInputShape is a 2D tensor.
 
@@ -110,7 +116,8 @@ bool fullyConnectedFloat32(const float* inputData, const nnfw::rt::Shape& inputS
   {
     auto relu_f = std::make_shared<ActT>();
 
-    const arm_compute::ActivationLayerInfo relu_info{arm_compute::ActivationLayerInfo::ActivationFunction::RELU};
+    const arm_compute::ActivationLayerInfo relu_info{
+        arm_compute::ActivationLayerInfo::ActivationFunction::RELU};
 
     // Do in-place update
     relu_f->configure(output.ptr(), nullptr, relu_info);
index 01bbff8..7c64e74 100644 (file)
 #endif // ACL_CORE_FUNC_NAME
 
 using namespace nnfw::kernel::acl;
-using fullyConnectedFloat32T = bool (*)(const float* inputData, const nnfw::rt::Shape& inputShape,
-                           const float* weightsData, const nnfw::rt::Shape& weightsShape,
-                           const float* biasData, const nnfw::rt::Shape& biasShape,
-                           int32_t activation,
-                           float* outputData, const nnfw::rt::Shape& outputShape);
+using fullyConnectedFloat32T = bool (*)(const float *inputData, const nnfw::rt::Shape &inputShape,
+                                        const float *weightsData,
+                                        const nnfw::rt::Shape &weightsShape, const float *biasData,
+                                        const nnfw::rt::Shape &biasShape, int32_t activation,
+                                        float *outputData, const nnfw::rt::Shape &outputShape);
 
-ACL_TEST(KernelACL_TC, fcFloat32_1) {
+ACL_TEST(KernelACL_TC, fcFloat32_1)
+{
 
-  util::TensorWrapper input({1,1,1,100});
-  util::TensorWrapper weights({1,100});
+  util::TensorWrapper input({1, 1, 1, 100});
+  util::TensorWrapper weights({1, 100});
   util::TensorWrapper bias({1});
-  util::TensorWrapper output({1,1});
+  util::TensorWrapper output({1, 1});
 
   int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
 
-  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.f;
-  });
-  weights.initValue([](uint32_t h, uint32_t w) {
-    return 1.f;
-  });
-  bias.initValue([](uint32_t w) {
-    return 0.f;
-  });
-  output.initValue([](uint32_t h, uint32_t w) {
-    return 0.f;
-  });
+  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.f; });
+  weights.initValue([](uint32_t h, uint32_t w) { return 1.f; });
+  bias.initValue([](uint32_t w) { return 0.f; });
+  output.initValue([](uint32_t h, uint32_t w) { return 0.f; });
 
-  bool bret = ACL_CORE_FUNC_NAME(input.ptr<float>(), input.shape(),
-      weights.ptr<float>(), weights.shape(),
-      bias.ptr<float>(), bias.shape(),
-      activation,
-      output.ptr<float>(), output.shape());
+  bool bret = ACL_CORE_FUNC_NAME(input.ptr<float>(), input.shape(), weights.ptr<float>(),
+                                 weights.shape(), bias.ptr<float>(), bias.shape(), activation,
+                                 output.ptr<float>(), output.shape());
 
   EXPECT_EQ(bret, true);
 
-  util::TensorWrapper expected({1,1});
-  expected.initValue([](uint32_t h, uint32_t w) {
-    return 100.f;
-  });
+  util::TensorWrapper expected({1, 1});
+  expected.initValue([](uint32_t h, uint32_t w) { return 100.f; });
 
   EXPECT_EQ(output, expected);
 }
 
-ACL_TEST(KernelACL_TC, fcFloat32_relu) {
+ACL_TEST(KernelACL_TC, fcFloat32_relu)
+{
 
-  util::TensorWrapper input({1,1,1,100});
-  util::TensorWrapper weights({1,100});
+  util::TensorWrapper input({1, 1, 1, 100});
+  util::TensorWrapper weights({1, 100});
   util::TensorWrapper bias({1});
-  util::TensorWrapper output({1,1});
+  util::TensorWrapper output({1, 1});
 
   int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
 
-  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.f;
-  });
-  weights.initValue([](uint32_t h, uint32_t w) {
-    return -1.f;
-  });
-  bias.initValue([](uint32_t w) {
-    return 0.f;
-  });
-  output.initValue([](uint32_t h, uint32_t w) {
-    return 0.f;
-  });
+  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.f; });
+  weights.initValue([](uint32_t h, uint32_t w) { return -1.f; });
+  bias.initValue([](uint32_t w) { return 0.f; });
+  output.initValue([](uint32_t h, uint32_t w) { return 0.f; });
 
-  bool bret = ACL_CORE_FUNC_NAME(input.ptr<float>(), input.shape(),
-      weights.ptr<float>(), weights.shape(),
-      bias.ptr<float>(), bias.shape(),
-      activation,
-      output.ptr<float>(), output.shape());
+  bool bret = ACL_CORE_FUNC_NAME(input.ptr<float>(), input.shape(), weights.ptr<float>(),
+                                 weights.shape(), bias.ptr<float>(), bias.shape(), activation,
+                                 output.ptr<float>(), output.shape());
 
   EXPECT_EQ(bret, true);
 
-  util::TensorWrapper expected({1,1});
-  expected.initValue([](uint32_t h, uint32_t w) {
-    return 0.f;
-  });
+  util::TensorWrapper expected({1, 1});
+  expected.initValue([](uint32_t h, uint32_t w) { return 0.f; });
 
   EXPECT_EQ(output, expected);
 }
 
-ACL_TEST(KernelACL_TC, fcFloat32_conv_fc) {
+ACL_TEST(KernelACL_TC, fcFloat32_conv_fc)
+{
   uint32_t input_n = 1;
   uint32_t input_c = 5;
   uint32_t input_h = 4;
@@ -123,7 +102,7 @@ ACL_TEST(KernelACL_TC, fcFloat32_conv_fc) {
   int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
 
   util::TensorWrapper input({input_n, input_h, input_w, input_c});
-  util::TensorWrapper weight({weight_n, input_c*input_h*input_w});
+  util::TensorWrapper weight({weight_n, input_c * input_h * input_w});
   util::TensorWrapper bias({weight_n});
   util::TensorWrapper output({1, weight_n});
 
@@ -133,45 +112,34 @@ ACL_TEST(KernelACL_TC, fcFloat32_conv_fc) {
     uint32_t W = input_w;
     uint32_t C = input_c;
 
-    return n*H*W*C + h*W*C + w*C + c;
+    return n * H * W * C + h * W * C + w * C + c;
   });
 
   weight.initValue([&](uint32_t h, uint32_t w) {
     uint32_t H = weight_n;
-    uint32_t W = input_c*input_h*input_w;
+    uint32_t W = input_c * input_h * input_w;
 
-    return h*W + w;
+    return h * W + w;
   });
 
-  bias.initValue([](uint32_t w) {
-    return 0.f;
-  });
+  bias.initValue([](uint32_t w) { return 0.f; });
 
-  output.initValue([](uint32_t h, uint32_t w) {
-    return 0.f;
-  });
+  output.initValue([](uint32_t h, uint32_t w) { return 0.f; });
 
-  bool bret = ACL_CORE_FUNC_NAME(input.ptr<float>(), input.shape(),
-      weight.ptr<float>(), weight.shape(),
-      bias.ptr<float>(), bias.shape(),
-      activation,
-      output.ptr<float>(), output.shape());
+  bool bret = ACL_CORE_FUNC_NAME(input.ptr<float>(), input.shape(), weight.ptr<float>(),
+                                 weight.shape(), bias.ptr<float>(), bias.shape(), activation,
+                                 output.ptr<float>(), output.shape());
 
   EXPECT_EQ(bret, true);
 
   util::TensorWrapper expected({1, weight_n});
-  expected.initValue({
-      167480.f,
-      420280.f,
-      673080.f,
-      925880.f,
-      1178680.f,
-      1431480.f});
+  expected.initValue({167480.f, 420280.f, 673080.f, 925880.f, 1178680.f, 1431480.f});
 
   EXPECT_EQ(output, expected);
 }
 
-ACL_TEST(KernelACL_TC, fcFloat32_fc_fc) {
+ACL_TEST(KernelACL_TC, fcFloat32_fc_fc)
+{
   uint32_t input_n = 6;
   uint32_t weight_n = 6;
 
@@ -191,76 +159,53 @@ ACL_TEST(KernelACL_TC, fcFloat32_fc_fc) {
     uint32_t H = weight_n;
     uint32_t W = input_n;
 
-    return (float)(h*W + w);
+    return (float)(h * W + w);
   });
 
-  bias.initValue([](uint32_t w) {
-    return 0.f;
-  });
+  bias.initValue([](uint32_t w) { return 0.f; });
 
-  output.initValue([](uint32_t h, uint32_t w) {
-    return 0.f;
-  });
+  output.initValue([](uint32_t h, uint32_t w) { return 0.f; });
 
-  bool bret = ACL_CORE_FUNC_NAME(input.ptr<float>(), input.shape(),
-      weight.ptr<float>(), weight.shape(),
-      bias.ptr<float>(), bias.shape(),
-      activation,
-      output.ptr<float>(), output.shape());
+  bool bret = ACL_CORE_FUNC_NAME(input.ptr<float>(), input.shape(), weight.ptr<float>(),
+                                 weight.shape(), bias.ptr<float>(), bias.shape(), activation,
+                                 output.ptr<float>(), output.shape());
 
   EXPECT_EQ(bret, true);
 
   util::TensorWrapper expected({1, weight_n});
   expected.initValue({
-    55.f,
-    145.f,
-    235.f,
-    325.f,
-    415.f,
-    505.f,
+      55.f, 145.f, 235.f, 325.f, 415.f, 505.f,
   });
 
   EXPECT_EQ(output, expected);
 }
 
-ACL_TEST(KernelACL_TC, fcFloat32_inceptionv3) {
+ACL_TEST(KernelACL_TC, fcFloat32_inceptionv3)
+{
 
   uint32_t input_c = 2048;
   uint32_t weight_n = 1008;
 
-  util::TensorWrapper input({1,1,1,input_c});
-  util::TensorWrapper weight({weight_n,input_c});
+  util::TensorWrapper input({1, 1, 1, input_c});
+  util::TensorWrapper weight({weight_n, input_c});
   util::TensorWrapper bias({weight_n});
   util::TensorWrapper output({1, weight_n});
 
   int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
 
-  input.initValue([&](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.f;
-  });
-  weight.initValue([&](uint32_t h, uint32_t w) {
-    return (float)h;
-  });
-  bias.initValue([](uint32_t w) {
-    return 0.f;
-  });
-  output.initValue([](uint32_t h, uint32_t w) {
-    return 0.f;
-  });
+  input.initValue([&](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.f; });
+  weight.initValue([&](uint32_t h, uint32_t w) { return (float)h; });
+  bias.initValue([](uint32_t w) { return 0.f; });
+  output.initValue([](uint32_t h, uint32_t w) { return 0.f; });
 
-  bool bret = ACL_CORE_FUNC_NAME(input.ptr<float>(), input.shape(),
-      weight.ptr<float>(), weight.shape(),
-      bias.ptr<float>(), bias.shape(),
-      activation,
-      output.ptr<float>(), output.shape());
+  bool bret = ACL_CORE_FUNC_NAME(input.ptr<float>(), input.shape(), weight.ptr<float>(),
+                                 weight.shape(), bias.ptr<float>(), bias.shape(), activation,
+                                 output.ptr<float>(), output.shape());
 
   EXPECT_EQ(bret, true);
 
   util::TensorWrapper expected({1, weight_n});
-  expected.initValue([&](uint32_t h, uint32_t w) {
-    return w*input_c;
-  });
+  expected.initValue([&](uint32_t h, uint32_t w) { return w * input_c; });
 
   EXPECT_EQ(output, expected);
 }
-
index de03ef2..6282668 100644 (file)
 
 #include <cassert>
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
 
-InputAccessor::InputAccessor(const float* inputData, const nnfw::rt::Shape& inputShape)
-  : _inputData(inputData)
-  , _inputShape(inputShape)
+InputAccessor::InputAccessor(const float *inputData, const nnfw::rt::Shape &inputShape)
+    : _inputData(inputData), _inputShape(inputShape)
 {
 }
 
-MatrixInputAccessor::MatrixInputAccessor(const float* inputData, const nnfw::rt::Shape& inputShape)
-  : _inputData(inputData)
-  , _inputShape(inputShape)
+MatrixInputAccessor::MatrixInputAccessor(const float *inputData, const nnfw::rt::Shape &inputShape)
+    : _inputData(inputData), _inputShape(inputShape)
 {
 }
 
-VectorInputAccessor::VectorInputAccessor(const float* inputData, const nnfw::rt::Shape& inputShape)
-  : _inputData(inputData)
-  , _inputShape(inputShape)
+VectorInputAccessor::VectorInputAccessor(const float *inputData, const nnfw::rt::Shape &inputShape)
+    : _inputData(inputData), _inputShape(inputShape)
 {
 }
 
-WeightAccessor::WeightAccessor(const float* filterData, const nnfw::rt::Shape& filterShape)
-  : _filterData(filterData)
-  , _filterShape(filterShape)
+WeightAccessor::WeightAccessor(const float *filterData, const nnfw::rt::Shape &filterShape)
+    : _filterData(filterData), _filterShape(filterShape)
 {
 }
 
-MatrixWeightAccessor::MatrixWeightAccessor(const float* filterData, const nnfw::rt::Shape& filterShape)
-  : _filterData(filterData)
-  , _filterShape(filterShape)
+MatrixWeightAccessor::MatrixWeightAccessor(const float *filterData,
+                                           const nnfw::rt::Shape &filterShape)
+    : _filterData(filterData), _filterShape(filterShape)
 {
 }
 
-BiasAccessor::BiasAccessor(const float* biasData, const nnfw::rt::Shape& biasShape)
-  : _biasData(biasData)
-  , _biasShape(biasShape)
+BiasAccessor::BiasAccessor(const float *biasData, const nnfw::rt::Shape &biasShape)
+    : _biasData(biasData), _biasShape(biasShape)
 {
 }
 
-OutputAccessor::OutputAccessor(float* outputData, const nnfw::rt::Shape& outputShape)
-  : _outputData(outputData)
-  , _outputShape(outputShape)
+OutputAccessor::OutputAccessor(float *outputData, const nnfw::rt::Shape &outputShape)
+    : _outputData(outputData), _outputShape(outputShape)
 {
 }
 
-MatrixOutputAccessor::MatrixOutputAccessor(float* outputData, const nnfw::rt::Shape& outputShape)
-  : _outputData(outputData)
-  , _outputShape(outputShape)
+MatrixOutputAccessor::MatrixOutputAccessor(float *outputData, const nnfw::rt::Shape &outputShape)
+    : _outputData(outputData), _outputShape(outputShape)
 {
 }
 
-VectorOutputAccessor::VectorOutputAccessor(float* outputData, const nnfw::rt::Shape& outputShape)
-  : _outputData(outputData)
-  , _outputShape(outputShape)
+VectorOutputAccessor::VectorOutputAccessor(float *outputData, const nnfw::rt::Shape &outputShape)
+    : _outputData(outputData), _outputShape(outputShape)
 {
 }
 
-static uint32_t getOffsetNCHW(const nnfw::rt::Shape& shape, const arm_compute::Coordinates& id)
+static uint32_t getOffsetNCHW(const nnfw::rt::Shape &shape, const arm_compute::Coordinates &id)
 {
   // get offset for ACL(NCHW) from data of NNAPI(NHWC)
-  uint32_t num    = getSizeOfDimension(shape, 0);
+  uint32_t num = getSizeOfDimension(shape, 0);
   uint32_t height = getSizeOfDimension(shape, 1);
-  uint32_t width  = getSizeOfDimension(shape, 2);
-  uint32_t chann  = getSizeOfDimension(shape, 3);
+  uint32_t width = getSizeOfDimension(shape, 2);
+  uint32_t chann = getSizeOfDimension(shape, 3);
   uint32_t stride = 1;
   uint32_t offset = 0;
   uint32_t numdim = id.num_dimensions();
-  offset += numdim > 0 ? id[0] * stride : 0; stride *= width;
-  offset += numdim > 1 ? id[1] * stride : 0; stride *= height;
-  offset += numdim > 2 ? id[2] * stride : 0; stride *= chann;
-  offset += numdim > 3 ? id[3] * stride : 0; stride *= num;
+  offset += numdim > 0 ? id[0] * stride : 0;
+  stride *= width;
+  offset += numdim > 1 ? id[1] * stride : 0;
+  stride *= height;
+  offset += numdim > 2 ? id[2] * stride : 0;
+  stride *= chann;
+  offset += numdim > 3 ? id[3] * stride : 0;
+  stride *= num;
   return offset;
 }
 
-static uint32_t getElementOffset(const nnfw::rt::Shape& shape,
-                                 uint32_t ch, uint32_t row, uint32_t col)
+static uint32_t getElementOffset(const nnfw::rt::Shape &shape, uint32_t ch, uint32_t row,
+                                 uint32_t col)
 {
   assert(getSizeOfDimension(shape, 0) == 1);
   assert(shape.dimensions.size() == 4);
@@ -113,8 +112,8 @@ static uint32_t getElementOffset(const nnfw::rt::Shape& shape,
   return offset;
 }
 
-static uint32_t getElementOffset(const nnfw::rt::Shape& shape,
-                                 uint32_t nth, uint32_t ch, uint32_t row, uint32_t col)
+static uint32_t getElementOffset(const nnfw::rt::Shape &shape, uint32_t nth, uint32_t ch,
+                                 uint32_t row, uint32_t col)
 {
   assert(shape.dimensions.size() == 4);
 
@@ -139,8 +138,7 @@ bool InputAccessor::access_tensor(arm_compute::ITensor &tensor)
   arm_compute::Window window;
   window.use_tensor_dimensions(tensor.info()->tensor_shape());
 
-  execute_window_loop(window, [&](const arm_compute::Coordinates& id)
-  {
+  execute_window_loop(window, [&](const arm_compute::Coordinates &id) {
     const uint32_t nth = id[3];
     const uint32_t ch = id[2];
     const uint32_t row = id[1];
@@ -148,8 +146,7 @@ bool InputAccessor::access_tensor(arm_compute::ITensor &tensor)
 
     uint32_t offset = getElementOffset(_inputShape, nth, ch, row, col);
 
-    *reinterpret_cast<float *>(tensor.ptr_to_element(id)) =
-        *(_inputData + offset);
+    *reinterpret_cast<float *>(tensor.ptr_to_element(id)) = *(_inputData + offset);
   });
   return true;
 }
@@ -161,16 +158,14 @@ bool MatrixInputAccessor::access_tensor(arm_compute::ITensor &tensor)
 
   assert(tensor.info()->tensor_shape().num_dimensions() <= 2);
 
-  execute_window_loop(window, [&](const arm_compute::Coordinates& id)
-  {
+  execute_window_loop(window, [&](const arm_compute::Coordinates &id) {
     const auto row = id[1];
     const auto col = id[0];
     const auto W = tensor.info()->tensor_shape().x();
 
     const auto offset = row * W + col;
 
-    *reinterpret_cast<float *>(tensor.ptr_to_element(id)) =
-        *(_inputData + offset);
+    *reinterpret_cast<float *>(tensor.ptr_to_element(id)) = *(_inputData + offset);
   });
   return true;
 }
@@ -182,12 +177,10 @@ bool VectorInputAccessor::access_tensor(arm_compute::ITensor &tensor)
 
   assert(tensor.info()->tensor_shape().num_dimensions() == 1);
 
-  execute_window_loop(window, [&](const arm_compute::Coordinates& id)
-  {
+  execute_window_loop(window, [&](const arm_compute::Coordinates &id) {
     uint32_t offset = id[0];
 
-    *reinterpret_cast<float *>(tensor.ptr_to_element(id)) =
-        *(_inputData + offset);
+    *reinterpret_cast<float *>(tensor.ptr_to_element(id)) = *(_inputData + offset);
   });
   return true;
 }
@@ -197,8 +190,7 @@ bool WeightAccessor::access_tensor(arm_compute::ITensor &tensor)
   arm_compute::Window window;
   window.use_tensor_dimensions(tensor.info()->tensor_shape());
 
-  execute_window_loop(window, [&](const arm_compute::Coordinates& id)
-  {
+  execute_window_loop(window, [&](const arm_compute::Coordinates &id) {
     const uint32_t nth = id[3];
     const uint32_t ch = id[2];
     const uint32_t row = id[1];
@@ -206,8 +198,7 @@ bool WeightAccessor::access_tensor(arm_compute::ITensor &tensor)
 
     uint32_t offset = getElementOffset(_filterShape, nth, ch, row, col);
 
-    *reinterpret_cast<float *>(tensor.ptr_to_element(id)) =
-        *(_filterData + offset);
+    *reinterpret_cast<float *>(tensor.ptr_to_element(id)) = *(_filterData + offset);
   });
   return true;
 }
@@ -219,16 +210,14 @@ bool MatrixWeightAccessor::access_tensor(arm_compute::ITensor &tensor)
 
   assert(tensor.info()->tensor_shape().num_dimensions() <= 2);
 
-  execute_window_loop(window, [&](const arm_compute::Coordinates& id)
-  {
+  execute_window_loop(window, [&](const arm_compute::Coordinates &id) {
     const auto row = id[1];
     const auto col = id[0];
     const auto W = tensor.info()->tensor_shape().x();
 
     uint32_t offset = row * W + col;
 
-    *reinterpret_cast<float *>(tensor.ptr_to_element(id)) =
-        *(_filterData + offset);
+    *reinterpret_cast<float *>(tensor.ptr_to_element(id)) = *(_filterData + offset);
   });
   return true;
 }
@@ -238,11 +227,9 @@ bool BiasAccessor::access_tensor(arm_compute::ITensor &tensor)
   arm_compute::Window window;
   window.use_tensor_dimensions(tensor.info()->tensor_shape());
 
-  execute_window_loop(window, [&](const arm_compute::Coordinates& id)
-  {
+  execute_window_loop(window, [&](const arm_compute::Coordinates &id) {
     uint32_t offset = getOffsetNCHW(_biasShape, id);
-    *reinterpret_cast<float *>(tensor.ptr_to_element(id)) =
-        *(_biasData + offset);
+    *reinterpret_cast<float *>(tensor.ptr_to_element(id)) = *(_biasData + offset);
   });
   return true;
 }
@@ -252,8 +239,7 @@ bool OutputAccessor::access_tensor(arm_compute::ITensor &tensor)
   arm_compute::Window window;
   window.use_tensor_dimensions(tensor.info()->tensor_shape());
 
-  execute_window_loop(window, [&](const arm_compute::Coordinates& id)
-  {
+  execute_window_loop(window, [&](const arm_compute::Coordinates &id) {
     const uint32_t nth = id[3];
     const uint32_t ch = id[2];
     const uint32_t row = id[1];
@@ -261,8 +247,7 @@ bool OutputAccessor::access_tensor(arm_compute::ITensor &tensor)
 
     uint32_t offset = getElementOffset(_outputShape, nth, ch, row, col);
 
-    *(_outputData + offset) =
-        *reinterpret_cast<float *>(tensor.ptr_to_element(id));
+    *(_outputData + offset) = *reinterpret_cast<float *>(tensor.ptr_to_element(id));
   });
   return false; // end the network
 }
@@ -274,14 +259,12 @@ bool VectorOutputAccessor::access_tensor(arm_compute::ITensor &tensor)
 
   assert(tensor.info()->tensor_shape().num_dimensions() == 1);
 
-  execute_window_loop(window, [&](const arm_compute::Coordinates& id)
-  {
+  execute_window_loop(window, [&](const arm_compute::Coordinates &id) {
     const uint32_t x = id[0];
 
     uint32_t offset = x;
 
-    *(_outputData + offset) =
-        *reinterpret_cast<float *>(tensor.ptr_to_element(id));
+    *(_outputData + offset) = *reinterpret_cast<float *>(tensor.ptr_to_element(id));
   });
   return false; // end the network
 }
@@ -293,16 +276,14 @@ bool MatrixOutputAccessor::access_tensor(arm_compute::ITensor &tensor)
 
   assert(tensor.info()->tensor_shape().num_dimensions() <= 2);
 
-  execute_window_loop(window, [&](const arm_compute::Coordinates& id)
-  {
+  execute_window_loop(window, [&](const arm_compute::Coordinates &id) {
     const auto row = id[1];
     const auto col = id[0];
     const auto W = tensor.info()->tensor_shape().x();
 
     const auto offset = row * W + col;
 
-    *(_outputData + offset) =
-        *reinterpret_cast<float *>(tensor.ptr_to_element(id));
+    *(_outputData + offset) = *reinterpret_cast<float *>(tensor.ptr_to_element(id));
   });
   return false; // end the network
 }
index e7670f1..ad53cc5 100644 (file)
 
 #include <OperationsUtils.h> // for nnfw::rt::Shape
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
 
 class InputAccessor : public arm_compute::graph::ITensorAccessor
 {
 public:
-    InputAccessor(const float* inputData, const nnfw::rt::Shape& inputShape);
-    InputAccessor(InputAccessor&&) = default;
+  InputAccessor(const float *inputData, const nnfw::rt::Shape &inputShape);
+  InputAccessor(InputAccessor &&) = default;
 
-    // Inherited methods overriden:
-    bool access_tensor(arm_compute::ITensor& tensor) override;
+  // Inherited methods overriden:
+  bool access_tensor(arm_compute::ITensor &tensor) override;
 
 private:
-    const float* _inputData;
-    const nnfw::rt::Shape& _inputShape;
+  const float *_inputData;
+  const nnfw::rt::Shape &_inputShape;
 };
 
 class MatrixInputAccessor : public arm_compute::graph::ITensorAccessor
 {
 public:
-    MatrixInputAccessor(const float* inputData, const nnfw::rt::Shape& inputShape);
-    MatrixInputAccessor(MatrixInputAccessor&&) = default;
+  MatrixInputAccessor(const float *inputData, const nnfw::rt::Shape &inputShape);
+  MatrixInputAccessor(MatrixInputAccessor &&) = default;
 
-    // Inherited methods overriden:
-    bool access_tensor(arm_compute::ITensor& tensor) override;
+  // Inherited methods overriden:
+  bool access_tensor(arm_compute::ITensor &tensor) override;
 
 private:
-    const float* _inputData;
-    const nnfw::rt::Shape& _inputShape;
+  const float *_inputData;
+  const nnfw::rt::Shape &_inputShape;
 };
 
 class VectorInputAccessor : public arm_compute::graph::ITensorAccessor
 {
 public:
-    VectorInputAccessor(const float* inputData, const nnfw::rt::Shape& inputShape);
-    VectorInputAccessor(VectorInputAccessor&&) = default;
+  VectorInputAccessor(const float *inputData, const nnfw::rt::Shape &inputShape);
+  VectorInputAccessor(VectorInputAccessor &&) = default;
 
-    // Inherited methods overriden:
-    bool access_tensor(arm_compute::ITensor& tensor) override;
+  // Inherited methods overriden:
+  bool access_tensor(arm_compute::ITensor &tensor) override;
 
 private:
-    const float* _inputData;
-    const nnfw::rt::Shape& _inputShape;
+  const float *_inputData;
+  const nnfw::rt::Shape &_inputShape;
 };
 
 class WeightAccessor : public arm_compute::graph::ITensorAccessor
 {
 public:
-    WeightAccessor(const float* filterData, const nnfw::rt::Shape& filterShape);
-    WeightAccessor(WeightAccessor&&) = default;
+  WeightAccessor(const float *filterData, const nnfw::rt::Shape &filterShape);
+  WeightAccessor(WeightAccessor &&) = default;
 
-    // Inherited methods overriden:
-    bool access_tensor(arm_compute::ITensor& tensor) override;
+  // Inherited methods overriden:
+  bool access_tensor(arm_compute::ITensor &tensor) override;
 
 private:
-    const float* _filterData;
-    const nnfw::rt::Shape& _filterShape;
+  const float *_filterData;
+  const nnfw::rt::Shape &_filterShape;
 };
 
 class MatrixWeightAccessor : public arm_compute::graph::ITensorAccessor
 {
 public:
-    MatrixWeightAccessor(const float* filterData, const nnfw::rt::Shape& filterShape);
-    MatrixWeightAccessor(MatrixWeightAccessor&&) = default;
+  MatrixWeightAccessor(const float *filterData, const nnfw::rt::Shape &filterShape);
+  MatrixWeightAccessor(MatrixWeightAccessor &&) = default;
 
-    // Inherited methods overriden:
-    bool access_tensor(arm_compute::ITensor& tensor) override;
+  // Inherited methods overriden:
+  bool access_tensor(arm_compute::ITensor &tensor) override;
 
 private:
-    const float* _filterData;
-    const nnfw::rt::Shape& _filterShape;
+  const float *_filterData;
+  const nnfw::rt::Shape &_filterShape;
 };
 
 class BiasAccessor : public arm_compute::graph::ITensorAccessor
 {
 public:
-    BiasAccessor(const float* biasData, const nnfw::rt::Shape& biasShape);
-    BiasAccessor(BiasAccessor&&) = default;
+  BiasAccessor(const float *biasData, const nnfw::rt::Shape &biasShape);
+  BiasAccessor(BiasAccessor &&) = default;
 
-    // Inherited methods overriden:
-    bool access_tensor(arm_compute::ITensor& tensor) override;
+  // Inherited methods overriden:
+  bool access_tensor(arm_compute::ITensor &tensor) override;
 
 private:
-    const float* _biasData;
-    const nnfw::rt::Shape& _biasShape;
+  const float *_biasData;
+  const nnfw::rt::Shape &_biasShape;
 };
 
 class OutputAccessor : public arm_compute::graph::ITensorAccessor
 {
 public:
-    OutputAccessor(float* outputData, const nnfw::rt::Shape& outputShape);
-    OutputAccessor(OutputAccessor&&) = default;
+  OutputAccessor(float *outputData, const nnfw::rt::Shape &outputShape);
+  OutputAccessor(OutputAccessor &&) = default;
 
-    // Inherited methods overriden:
-    bool access_tensor(arm_compute::ITensor& tensor) override;
+  // Inherited methods overriden:
+  bool access_tensor(arm_compute::ITensor &tensor) override;
 
 private:
-    float* _outputData;
-    const nnfw::rt::Shape& _outputShape;
+  float *_outputData;
+  const nnfw::rt::Shape &_outputShape;
 };
 
 class MatrixOutputAccessor : public arm_compute::graph::ITensorAccessor
 {
 public:
-    MatrixOutputAccessor(float* outputData, const nnfw::rt::Shape& outputShape);
-    MatrixOutputAccessor(MatrixOutputAccessor&&) = default;
+  MatrixOutputAccessor(float *outputData, const nnfw::rt::Shape &outputShape);
+  MatrixOutputAccessor(MatrixOutputAccessor &&) = default;
 
-    // Inherited methods overriden:
-    bool access_tensor(arm_compute::ITensor& tensor) override;
+  // Inherited methods overriden:
+  bool access_tensor(arm_compute::ITensor &tensor) override;
 
 private:
-    float* _outputData;
-    const nnfw::rt::Shape& _outputShape;
+  float *_outputData;
+  const nnfw::rt::Shape &_outputShape;
 };
 
 class VectorOutputAccessor : public arm_compute::graph::ITensorAccessor
 {
 public:
-    VectorOutputAccessor(float* outputData, const nnfw::rt::Shape& outputShape);
-    VectorOutputAccessor(VectorOutputAccessor&&) = default;
+  VectorOutputAccessor(float *outputData, const nnfw::rt::Shape &outputShape);
+  VectorOutputAccessor(VectorOutputAccessor &&) = default;
 
-    // Inherited methods overriden:
-    bool access_tensor(arm_compute::ITensor& tensor) override;
+  // Inherited methods overriden:
+  bool access_tensor(arm_compute::ITensor &tensor) override;
 
 private:
-    float* _outputData;
-    const nnfw::rt::Shape& _outputShape;
+  float *_outputData;
+  const nnfw::rt::Shape &_outputShape;
 };
 
-template<typename AccessorType>
-inline void TensorAccess(arm_compute::CLTensor& tensor, const float* data,
-                         const nnfw::rt::Shapeshape)
+template <typename AccessorType>
+inline void TensorAccess(arm_compute::CLTensor &tensor, const float *data,
+                         const nnfw::rt::Shape &shape)
 {
   tensor.map();
   AccessorType accessor(data, shape);
@@ -163,9 +166,8 @@ inline void TensorAccess(arm_compute::CLTensor& tensor, const float* data,
   tensor.unmap();
 }
 
-template<typename AccessorType>
-inline void TensorAccess(arm_compute::CLTensor& tensor, float* data,
-                         const nnfw::rt::Shape& shape)
+template <typename AccessorType>
+inline void TensorAccess(arm_compute::CLTensor &tensor, float *data, const nnfw::rt::Shape &shape)
 {
   tensor.map();
   AccessorType accessor(data, shape);
@@ -173,17 +175,16 @@ inline void TensorAccess(arm_compute::CLTensor& tensor, float* data,
   tensor.unmap();
 }
 
-template<typename AccessorType>
-inline void TensorAccess(arm_compute::Tensor& tensor, const float* data,
-                         const nnfw::rt::Shapeshape)
+template <typename AccessorType>
+inline void TensorAccess(arm_compute::Tensor &tensor, const float *data,
+                         const nnfw::rt::Shape &shape)
 {
   AccessorType accessor(data, shape);
   accessor.access_tensor(tensor);
 }
 
-template<typename AccessorType>
-inline void TensorAccess(arm_compute::Tensor& tensor, float* data,
-                         const nnfw::rt::Shape& shape)
+template <typename AccessorType>
+inline void TensorAccess(arm_compute::Tensor &tensor, float *data, const nnfw::rt::Shape &shape)
 {
   AccessorType accessor(data, shape);
   accessor.access_tensor(tensor);
index cabf079..c2c8d79 100644 (file)
 #include <arm_compute/runtime/CL/CLScheduler.h>
 #include <kernel/acl/nnfw_kernel_acl.h>
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
 
 // This will do one time initialization but can be called multiple times
-void Initialize(void)
-{
-  arm_compute::CLScheduler::get().default_init();
-}
+void Initialize(void) { arm_compute::CLScheduler::get().default_init(); }
 
 } // namespace acl
 } // namespace kernel
index ebd8247..00bd743 100644 (file)
 #include "IO_accessor.h"
 #include "shape.h"
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
 
-namespace common {
+namespace common
+{
 
-typedef std::function<void (void)> sync_scheduler_f;
+typedef std::function<void(void)> sync_scheduler_f;
 
-template<class TensorT, class LayerT>
-bool reshapeGeneric(const void* inputData, const nnfw::rt::Shape& inputShape,
-                    void* outputData, const nnfw::rt::Shape& outputShape,
-                    sync_scheduler_f sync_scheduler) {
+template <class TensorT, class LayerT>
+bool reshapeGeneric(const void *inputData, const nnfw::rt::Shape &inputShape, void *outputData,
+                    const nnfw::rt::Shape &outputShape, sync_scheduler_f sync_scheduler)
+{
 
   auto input_shape = util::fromNNShape(inputShape);
   auto output_shape = util::fromNNShape(outputShape);
@@ -50,13 +54,13 @@ bool reshapeGeneric(const void* inputData, const nnfw::rt::Shape& inputShape,
   input.allocate();
   output.allocate();
 
-  TensorAccess<InputAccessor>(input.ref(), (float*)inputData, inputShape);
+  TensorAccess<InputAccessor>(input.ref(), (float *)inputData, inputShape);
 
   l.run();
 
   sync_scheduler();
 
-  TensorAccess<OutputAccessor>(output.ref(), (float*)outputData, outputShape);
+  TensorAccess<OutputAccessor>(output.ref(), (float *)outputData, outputShape);
 
   return true;
 }
index a96a896..a666aea 100644 (file)
 
 using namespace nnfw::kernel::acl;
 
-ACL_TEST(KernelACL_TC, reshape_1) {
-  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1,1,9,1}, 1.0, 0};
+ACL_TEST(KernelACL_TC, reshape_1)
+{
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 1, 9, 1}, 1.0, 0};
   float inputData[9] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
 
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   float outputData[9] = {0};
 
-  bool bret = ACL_CORE_FUNC_NAME(inputData, inputShape,
-      outputData, outputShape);
+  bool bret = ACL_CORE_FUNC_NAME(inputData, inputShape, outputData, outputShape);
 
   EXPECT_EQ(bret, true);
 
   float expectData[9] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
-
 }
index d9182c8..af00f49 100644 (file)
 #include <arm_compute/runtime/Tensor.h>
 #include <arm_compute/runtime/CL/CLTensor.h>
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
 
-template<class TensorT>
-class UniqueTensor
+template <class TensorT> class UniqueTensor
 {
 public:
-  UniqueTensor(const ::arm_compute::TensorInfo &info)
-  {
-    _tensor.allocator()->init(info);
-  }
+  UniqueTensor(const ::arm_compute::TensorInfo &info) { _tensor.allocator()->init(info); }
 
 public:
   // Both copy and move are not allowed
@@ -39,16 +38,10 @@ public:
   UniqueTensor(UniqueTensor &&) = delete;
 
 public:
-  ~UniqueTensor()
-  {
-    _tensor.allocator()->free();
-  }
+  ~UniqueTensor() { _tensor.allocator()->free(); }
 
 public:
-  void allocate()
-  {
-    _tensor.allocator()->allocate();
-  }
+  void allocate() { _tensor.allocator()->allocate(); }
 
 public:
   TensorT &ref(void) { return _tensor; }
index 9376006..effaa64 100644 (file)
 #include "../IO_accessor.h"
 #include "../shape.h"
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
 
-bool concatenationFloat32(const std::vector<const float*>& inputDataPtrs,
-                          const std::vector<nnfw::rt::Shape>inputShapes, int32_t axis,
-                          float* outputData, const nnfw::rt::Shape& outputShape)
+bool concatenationFloat32(const std::vector<const float *> &inputDataPtrs,
+                          const std::vector<nnfw::rt::Shape> &inputShapes, int32_t axis,
+                          float *outputData, const nnfw::rt::Shape &outputShape)
 {
   if (axis != 3)
   {
@@ -39,17 +42,17 @@ bool concatenationFloat32(const std::vector<const float*>& inputDataPtrs,
   }
   assert(inputDataPtrs.size() == inputShapes.size());
 
-  std::vector<arm_compute::CLTensor*> inputPtrs;
-  std::vector<arm_compute::ICLTensor*> inputIptrs;
+  std::vector<arm_compute::CLTensor *> inputPtrs;
+  std::vector<arm_compute::ICLTensor *> inputIptrs;
   arm_compute::CLTensor output;
 
   // init Tensors
   std::vector<nnfw::rt::Shape>::const_iterator it_inputShape = inputShapes.begin();
   for (auto inputData : inputDataPtrs)
   {
-    const nnfw::rt::ShapeinputShape = *it_inputShape;
+    const nnfw::rt::Shape &inputShape = *it_inputShape;
     arm_compute::TensorShape input_shape = util::fromNNShape(inputShape);
-    arm_compute::CLTensorinputPtr = new arm_compute::CLTensor();
+    arm_compute::CLTensor *inputPtr = new arm_compute::CLTensor();
 
     inputPtr->allocator()->init(arm_compute::TensorInfo(input_shape, arm_compute::Format::F32));
     inputPtrs.push_back(inputPtr);
@@ -66,13 +69,13 @@ bool concatenationFloat32(const std::vector<const float*>& inputDataPtrs,
 
   // allocate Tensors
   it_inputShape = inputShapes.begin();
-  std::vector<const float*>::const_iterator it_inputData = inputDataPtrs.begin();
+  std::vector<const float *>::const_iterator it_inputData = inputDataPtrs.begin();
   for (auto inputPtr : inputPtrs)
   {
     inputPtr->allocator()->allocate();
 
-    const floatinputData = *it_inputData;
-    const nnfw::rt::ShapeinputShape = *it_inputShape;
+    const float *inputData = *it_inputData;
+    const nnfw::rt::Shape &inputShape = *it_inputShape;
 
     TensorAccess<InputAccessor>(*inputPtr, inputData, inputShape);
 
index b2c5a58..40b22cf 100644 (file)
@@ -27,17 +27,17 @@ using namespace nnfw::kernel::acl;
 TEST(KernelACL_TC, concatFloat32_1)
 {
   float inputData_1[6] = {
-    1, 2, 3, 4, 5, 6      // [ [ [1],[2],[3] ], [ [4],[5],[6] ] ]
+      1, 2, 3, 4, 5, 6 // [ [ [1],[2],[3] ], [ [4],[5],[6] ] ]
   };
   float inputData_2[6] = {
-    7, 8, 9, 10, 11, 12   // [ [ [7],[8],[9] ], [ [10],[11],[12] ] ]
+      7, 8, 9, 10, 11, 12 // [ [ [7],[8],[9] ], [ [10],[11],[12] ] ]
   };
-  const nnfw::rt::Shape inputShape_1 = { OperandType::FLOAT32, {1,2,3,1}, 1.0, 0 };
-  const nnfw::rt::Shape inputShape_2 = { OperandType::FLOAT32, {1,2,3,1}, 1.0, 0 };
-  std::vector<const float*> inputDataPtrs;
+  const nnfw::rt::Shape inputShape_1 = {OperandType::FLOAT32, {1, 2, 3, 1}, 1.0, 0};
+  const nnfw::rt::Shape inputShape_2 = {OperandType::FLOAT32, {1, 2, 3, 1}, 1.0, 0};
+  std::vector<const float *> inputDataPtrs;
   std::vector<nnfw::rt::Shape> inputShapes;
   float outputData[12];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,2,3,2}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 2, 3, 2}, 1.0, 0};
   bool bret;
 
   inputDataPtrs.push_back(inputData_1);
@@ -47,14 +47,10 @@ TEST(KernelACL_TC, concatFloat32_1)
 
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
-  bret = concatenationFloat32(inputDataPtrs, inputShapes, 3, 
-                              outputData, outputShape);
+  bret = concatenationFloat32(inputDataPtrs, inputShapes, 3, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectNCHW[] = {
-    1, 2, 3, 4, 5, 6,
-    7, 8, 9, 10, 11, 12
-  };
+  float expectNCHW[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
   float expectData[12]; // [ [ [1,7],[2,8],[3,9] ], [ [4,10],[5,11],[6,12] ] ]
   util::NCHW2NHWC(expectNCHW, expectData, outputShape);
   bret = util::compareData(outputData, expectData, outputShape);
index f71bbeb..c464c51 100644 (file)
 
 #include "support/nnapi/feature/Reader.h"
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
 
 static int verbose = 0;
 
-bool convFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
-                 const float* filterData, const nnfw::rt::Shape& filterShape,
-                 const float* biasData, const nnfw::rt::Shape& biasShape,
-                 int32_t padding_left, int32_t padding_right,
-                 int32_t padding_top, int32_t padding_bottom,
-                 int32_t stride_width, int32_t stride_height,
-                 int32_t activation,
-                 float* outputData, const nnfw::rt::Shape& outputShape)
+bool convFloat32(const float *inputData, const nnfw::rt::Shape &inputShape, const float *filterData,
+                 const nnfw::rt::Shape &filterShape, const float *biasData,
+                 const nnfw::rt::Shape &biasShape, int32_t padding_left, int32_t padding_right,
+                 int32_t padding_top, int32_t padding_bottom, int32_t stride_width,
+                 int32_t stride_height, int32_t activation, float *outputData,
+                 const nnfw::rt::Shape &outputShape)
 {
   arm_compute::TensorShape input_shape = util::fromNNShape(inputShape);
   arm_compute::TensorShape filter_shape = util::fromNNShape(filterShape);
   arm_compute::TensorShape bias_shape = util::fromVectorNNShape(biasShape);
   arm_compute::TensorShape output_shape = util::fromNNShape(outputShape);
-  arm_compute::PadStrideInfo conv_info = arm_compute::PadStrideInfo(stride_width, stride_height,
-                                              padding_left, padding_right,
-                                              padding_top, padding_bottom,
-                                              arm_compute::DimensionRoundingType::FLOOR);
+  arm_compute::PadStrideInfo conv_info = arm_compute::PadStrideInfo(
+      stride_width, stride_height, padding_left, padding_right, padding_top, padding_bottom,
+      arm_compute::DimensionRoundingType::FLOOR);
 
   CLUniqueTensor input(arm_compute::TensorInfo(input_shape, arm_compute::Format::F32));
   CLUniqueTensor output(arm_compute::TensorInfo(output_shape, arm_compute::Format::F32));
@@ -69,7 +69,8 @@ bool convFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
 
   fns.emplace_back(conv_f);
 
-  util::insertFusedActivationLayer<CLUniqueTensor, arm_compute::CLActivationLayer>(output, activation, fns);
+  util::insertFusedActivationLayer<CLUniqueTensor, arm_compute::CLActivationLayer>(output,
+                                                                                   activation, fns);
 
   input.allocate();
   output.allocate();
@@ -89,7 +90,8 @@ bool convFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
     nnfw::support::acl::feature::Reader<float> acl_ifm_reader{input.ptr()};
 
     std::cout << "NNAPI IFM:" << std::endl;
-    std::cout << nnfw::util::feature::TextFormatter<float>{ifm_shape, nnapi_ifm_reader} << std::endl;
+    std::cout << nnfw::util::feature::TextFormatter<float>{ifm_shape, nnapi_ifm_reader}
+              << std::endl;
 
     std::cout << "ARM Compute IFM:" << std::endl;
     std::cout << nnfw::util::feature::TextFormatter<float>{ifm_shape, acl_ifm_reader} << std::endl;
index e34cdee..421e659 100644 (file)
@@ -27,11 +27,11 @@ using namespace nnfw::kernel::acl;
 TEST(KernelACL_TC, convFloat32_3x3to1x1)
 {
   float inputData[9];
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   float filterData[9];
-  const nnfw::rt::Shape filterShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
-  float biasData[1] = { 1.0 };
-  const nnfw::rt::Shape biasShape = { OperandType::FLOAT32, {1}, 1.0, 0 };
+  const nnfw::rt::Shape filterShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
+  float biasData[1] = {1.0};
+  const nnfw::rt::Shape biasShape = {OperandType::FLOAT32, {1}, 1.0, 0};
   int32_t padding_left = 0;
   int32_t padding_right = 0;
   int32_t padding_top = 0;
@@ -40,24 +40,19 @@ TEST(KernelACL_TC, convFloat32_3x3to1x1)
   int32_t stride_height = 1;
   int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
   float outputData[1];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,1,1,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 1, 1, 1}, 1.0, 0};
   bool bret;
 
   util::initData(inputData, sizeof(inputData) / sizeof(inputData[0]), 1.0);
   util::initData(filterData, sizeof(filterData) / sizeof(filterData[0]), 1.0);
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
-  bret = convFloat32(inputData, inputShape,
-                     filterData, filterShape,
-                     biasData, biasShape,
-                     padding_left, padding_right,
-                     padding_top, padding_bottom,
-                     stride_width, stride_height,
-                     activation,
-                     outputData, outputShape);
+  bret = convFloat32(inputData, inputShape, filterData, filterShape, biasData, biasShape,
+                     padding_left, padding_right, padding_top, padding_bottom, stride_width,
+                     stride_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = { 10.0f };
+  float expectData[] = {10.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
@@ -65,11 +60,11 @@ TEST(KernelACL_TC, convFloat32_3x3to1x1)
 TEST(KernelACL_TC, convFloat32_3x3to3x3)
 {
   float inputData[9];
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   float filterData[9];
-  const nnfw::rt::Shape filterShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
-  float biasData[1] = { 1.0 };
-  const nnfw::rt::Shape biasShape = { OperandType::FLOAT32, {1}, 1.0, 0 };
+  const nnfw::rt::Shape filterShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
+  float biasData[1] = {1.0};
+  const nnfw::rt::Shape biasShape = {OperandType::FLOAT32, {1}, 1.0, 0};
   int32_t padding_left = 1;
   int32_t padding_right = 1;
   int32_t padding_top = 1;
@@ -78,28 +73,19 @@ TEST(KernelACL_TC, convFloat32_3x3to3x3)
   int32_t stride_height = 1;
   int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
   float outputData[9];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   bool bret;
 
   util::initData(inputData, sizeof(inputData) / sizeof(inputData[0]), 1.0);
   util::initData(filterData, sizeof(filterData) / sizeof(filterData[0]), 1.0);
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
-  bret = convFloat32(inputData, inputShape,
-                     filterData, filterShape,
-                     biasData, biasShape,
-                     padding_left, padding_right,
-                     padding_top, padding_bottom,
-                     stride_width, stride_height,
-                     activation,
-                     outputData, outputShape);
+  bret = convFloat32(inputData, inputShape, filterData, filterShape, biasData, biasShape,
+                     padding_left, padding_right, padding_top, padding_bottom, stride_width,
+                     stride_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = {
-    5.0f, 7.0f, 5.0f,
-    7.0f, 10.0f, 7.0f,
-    5.0f, 7.0f, 5.0f
-  };
+  float expectData[] = {5.0f, 7.0f, 5.0f, 7.0f, 10.0f, 7.0f, 5.0f, 7.0f, 5.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
@@ -107,11 +93,11 @@ TEST(KernelACL_TC, convFloat32_3x3to3x3)
 TEST(KernelACL_TC, convFloat32_3x3to3x3_RELU)
 {
   float inputData[9];
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   float filterData[9];
-  const nnfw::rt::Shape filterShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
-  float biasData[1] = { -5.0f };
-  const nnfw::rt::Shape biasShape = { OperandType::FLOAT32, {1}, 1.0, 0 };
+  const nnfw::rt::Shape filterShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
+  float biasData[1] = {-5.0f};
+  const nnfw::rt::Shape biasShape = {OperandType::FLOAT32, {1}, 1.0, 0};
   int32_t padding_left = 1;
   int32_t padding_right = 1;
   int32_t padding_top = 1;
@@ -120,29 +106,19 @@ TEST(KernelACL_TC, convFloat32_3x3to3x3_RELU)
   int32_t stride_height = 1;
   int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
   float outputData[9];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   bool bret;
 
   util::initData(inputData, sizeof(inputData) / sizeof(inputData[0]), 1.0);
   util::initData(filterData, sizeof(filterData) / sizeof(filterData[0]), 1.0);
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
-  bret = convFloat32(inputData, inputShape,
-                     filterData, filterShape,
-                     biasData, biasShape,
-                     padding_left, padding_right,
-                     padding_top, padding_bottom,
-                     stride_width, stride_height,
-                     activation,
-                     outputData, outputShape);
+  bret = convFloat32(inputData, inputShape, filterData, filterShape, biasData, biasShape,
+                     padding_left, padding_right, padding_top, padding_bottom, stride_width,
+                     stride_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] =
-  {
-    0.0f, 1.0f, 0.0f,
-    1.0f, 4.0f, 1.0f,
-    0.0f, 1.0f, 0.0f
-  };
+  float expectData[] = {0.0f, 1.0f, 0.0f, 1.0f, 4.0f, 1.0f, 0.0f, 1.0f, 0.0f};
 
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
@@ -150,19 +126,12 @@ TEST(KernelACL_TC, convFloat32_3x3to3x3_RELU)
 
 TEST(KernelACL_TC, convFloat32_3x5to3x3)
 {
-  float inputData[15] = {
-    1,2,3,4,5,
-    6,7,8,9,10,
-    11,12,13,14,15
-  };
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,5,1}, 1.0, 0 };
-  float filterData[18] = {
-    1,1,1, 1,1,1, 1,1,1,
-    2,2,2, 2,2,2, 2,2,2
-  };
-  const nnfw::rt::Shape filterShape = { OperandType::FLOAT32, {2,3,3,1}, 1.0, 0 };
-  float biasData[2] = { 1.0, 1.0 };
-  const nnfw::rt::Shape biasShape = { OperandType::FLOAT32, {2}, 1.0, 0 };
+  float inputData[15] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 5, 1}, 1.0, 0};
+  float filterData[18] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2};
+  const nnfw::rt::Shape filterShape = {OperandType::FLOAT32, {2, 3, 3, 1}, 1.0, 0};
+  float biasData[2] = {1.0, 1.0};
+  const nnfw::rt::Shape biasShape = {OperandType::FLOAT32, {2}, 1.0, 0};
   int32_t padding_left = 1;
   int32_t padding_right = 1;
   int32_t padding_top = 1;
@@ -171,30 +140,21 @@ TEST(KernelACL_TC, convFloat32_3x5to3x3)
   int32_t stride_height = 1;
   int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
   float outputData[30];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,3,5,2}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 3, 5, 2}, 1.0, 0};
   bool bret;
 
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
-  bret = convFloat32(inputData, inputShape,
-                     filterData, filterShape,
-                     biasData, biasShape,
-                     padding_left, padding_right,
-                     padding_top, padding_bottom,
-                     stride_width, stride_height,
-                     activation,
-                     outputData, outputShape);
+  bret = convFloat32(inputData, inputShape, filterData, filterShape, biasData, biasShape,
+                     padding_left, padding_right, padding_top, padding_bottom, stride_width,
+                     stride_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectNCHW[] = {
-    17.0f, 28.0f, 34.0f, 40.0f, 29.0f,
-    40.0f, 64.0f, 73.0f, 82.0f, 58.0f,
-    37.0f, 58.0f, 64.0f, 70.0f, 49.0f,
+  float expectNCHW[] = {17.0f,  28.0f,  34.0f, 40.0f,  29.0f,  40.0f,  64.0f,  73.0f,
+                        82.0f,  58.0f,  37.0f, 58.0f,  64.0f,  70.0f,  49.0f,
 
-    33.0f, 55.0f, 67.0f, 79.0f, 57.0f,
-    79.0f, 127.0f, 145.0f, 163.0f, 115.0f,
-    73.0f, 115.0f, 127.0f, 139.0f, 97.0f
-  };
+                        33.0f,  55.0f,  67.0f, 79.0f,  57.0f,  79.0f,  127.0f, 145.0f,
+                        163.0f, 115.0f, 73.0f, 115.0f, 127.0f, 139.0f, 97.0f};
   float expectData[30];
   util::NCHW2NHWC(expectNCHW, expectData, outputShape);
   bret = util::compareData(outputData, expectData, outputShape);
index 98ad3ec..bedfd97 100644 (file)
 #include "../UniqueTensor.h"
 #include "../DepthwiseConv2D.h"
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
-
-static void sync_scheduler() {
-  arm_compute::CLScheduler::get().sync();
-}
-
-bool depthwiseConvFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
-                          const float* filterData, const nnfw::rt::Shape& filterShape,
-                          const float* biasData, const nnfw::rt::Shape& biasShape,
-                          int32_t padding_left, int32_t padding_right,
-                          int32_t padding_top, int32_t padding_bottom,
-                          int32_t stride_width, int32_t stride_height,
-                          int32_t depth_multiplier, int32_t activation,
-                          float* outputData, const nnfw::rt::Shape& outputShape) {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
+
+static void sync_scheduler() { arm_compute::CLScheduler::get().sync(); }
+
+bool depthwiseConvFloat32(const float *inputData, const nnfw::rt::Shape &inputShape,
+                          const float *filterData, const nnfw::rt::Shape &filterShape,
+                          const float *biasData, const nnfw::rt::Shape &biasShape,
+                          int32_t padding_left, int32_t padding_right, int32_t padding_top,
+                          int32_t padding_bottom, int32_t stride_width, int32_t stride_height,
+                          int32_t depth_multiplier, int32_t activation, float *outputData,
+                          const nnfw::rt::Shape &outputShape)
+{
   return common::depthwiseConvFloat32<CLUniqueTensor, arm_compute::CLDepthwiseConvolutionLayer,
-  arm_compute::CLActivationLayer>(inputData, inputShape,
-      filterData, filterShape,
-      biasData, biasShape,
-      padding_left, padding_right,
-      padding_top, padding_bottom,
-      stride_width, stride_height,
-      depth_multiplier, activation,
-      outputData, outputShape,
-      sync_scheduler);
+                                      arm_compute::CLActivationLayer>(
+      inputData, inputShape, filterData, filterShape, biasData, biasShape, padding_left,
+      padding_right, padding_top, padding_bottom, stride_width, stride_height, depth_multiplier,
+      activation, outputData, outputShape, sync_scheduler);
 }
 
 } // namespace acl
 } // namespace kernel
 } // namespace nnfw
-
index 62fee4e..318edda 100644 (file)
 #include "../UniqueTensor.h"
 #include "../FullyConnected.h"
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
 
-void sync_scheduler() {
-  arm_compute::CLScheduler::get().sync();
-}
+void sync_scheduler() { arm_compute::CLScheduler::get().sync(); }
 
-bool fullyConnectedFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
-                           const float* weightsData, const nnfw::rt::Shape& weightsShape,
-                           const float* biasData, const nnfw::rt::Shape& biasShape,
-                           int32_t activation,
-                           float* outputData, const nnfw::rt::Shape& outputShape) {
+bool fullyConnectedFloat32(const float *inputData, const nnfw::rt::Shape &inputShape,
+                           const float *weightsData, const nnfw::rt::Shape &weightsShape,
+                           const float *biasData, const nnfw::rt::Shape &biasShape,
+                           int32_t activation, float *outputData,
+                           const nnfw::rt::Shape &outputShape)
+{
   return common::fullyConnectedFloat32<CLUniqueTensor, arm_compute::CLFullyConnectedLayer,
-  arm_compute::CLActivationLayer>(inputData, inputShape,
-      weightsData, weightsShape,
-      biasData, biasShape,
-      activation,
-      outputData, outputShape,
-      sync_scheduler);
+                                       arm_compute::CLActivationLayer>(
+      inputData, inputShape, weightsData, weightsShape, biasData, biasShape, activation, outputData,
+      outputShape, sync_scheduler);
 }
 
 } // namespace acl
index 5fb5318..21e4925 100644 (file)
 
 #include <cassert>
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
-
-bool maxPoolFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
-                 int32_t padding_left, int32_t padding_right,
-                 int32_t padding_top, int32_t padding_bottom,
-                 int32_t stride_width, int32_t stride_height,
-                 int32_t filter_width, int32_t filter_height,
-                 int32_t activation,
-                 float* outputData, const nnfw::rt::Shape& outputShape)
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
+
+bool maxPoolFloat32(const float *inputData, const nnfw::rt::Shape &inputShape, int32_t padding_left,
+                    int32_t padding_right, int32_t padding_top, int32_t padding_bottom,
+                    int32_t stride_width, int32_t stride_height, int32_t filter_width,
+                    int32_t filter_height, int32_t activation, float *outputData,
+                    const nnfw::rt::Shape &outputShape)
 {
   arm_compute::TensorShape input_shape = util::fromNNShape(inputShape);
   arm_compute::TensorShape output_shape = util::fromNNShape(outputShape);
 
   std::vector<std::shared_ptr<arm_compute::IFunction>> fns;
 
-  arm_compute::PadStrideInfo pad_info = arm_compute::PadStrideInfo(stride_width, stride_height,
-                                              padding_left, padding_right,
-                                              padding_top, padding_bottom,
-                                              arm_compute::DimensionRoundingType::FLOOR);
+  arm_compute::PadStrideInfo pad_info = arm_compute::PadStrideInfo(
+      stride_width, stride_height, padding_left, padding_right, padding_top, padding_bottom,
+      arm_compute::DimensionRoundingType::FLOOR);
 
-  arm_compute::PoolingLayerInfo maxpool_info = arm_compute::PoolingLayerInfo(arm_compute::PoolingType::MAX,
-                                                        arm_compute::Size2D(filter_width,filter_height),
-                                                        pad_info, false);
+  arm_compute::PoolingLayerInfo maxpool_info = arm_compute::PoolingLayerInfo(
+      arm_compute::PoolingType::MAX, arm_compute::Size2D(filter_width, filter_height), pad_info,
+      false);
 
   CLUniqueTensor input(arm_compute::TensorInfo(input_shape, arm_compute::Format::F32));
   CLUniqueTensor output(arm_compute::TensorInfo(output_shape, arm_compute::Format::F32));
@@ -60,7 +60,8 @@ bool maxPoolFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
   input.allocate();
   output.allocate();
 
-  util::insertFusedActivationLayer<CLUniqueTensor, arm_compute::CLActivationLayer>(output, activation, fns);
+  util::insertFusedActivationLayer<CLUniqueTensor, arm_compute::CLActivationLayer>(output,
+                                                                                   activation, fns);
 
   TensorAccess<InputAccessor>(input.ref(), inputData, inputShape);
 
@@ -76,27 +77,24 @@ bool maxPoolFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
   return true;
 }
 
-bool averagePoolFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
-                 int32_t padding_left, int32_t padding_right,
-                 int32_t padding_top, int32_t padding_bottom,
-                 int32_t stride_width, int32_t stride_height,
-                 int32_t filter_width, int32_t filter_height,
-                 int32_t activation,
-                 float* outputData, const nnfw::rt::Shape& outputShape)
+bool averagePoolFloat32(const float *inputData, const nnfw::rt::Shape &inputShape,
+                        int32_t padding_left, int32_t padding_right, int32_t padding_top,
+                        int32_t padding_bottom, int32_t stride_width, int32_t stride_height,
+                        int32_t filter_width, int32_t filter_height, int32_t activation,
+                        float *outputData, const nnfw::rt::Shape &outputShape)
 {
   arm_compute::TensorShape input_shape = util::fromNNShape(inputShape);
   arm_compute::TensorShape output_shape = util::fromNNShape(outputShape);
 
   std::vector<std::shared_ptr<arm_compute::IFunction>> fns;
 
-  arm_compute::PadStrideInfo pad_info = arm_compute::PadStrideInfo(stride_width, stride_height,
-                                              padding_left, padding_right,
-                                              padding_top, padding_bottom,
-                                              arm_compute::DimensionRoundingType::FLOOR);
+  arm_compute::PadStrideInfo pad_info = arm_compute::PadStrideInfo(
+      stride_width, stride_height, padding_left, padding_right, padding_top, padding_bottom,
+      arm_compute::DimensionRoundingType::FLOOR);
 
-  arm_compute::PoolingLayerInfo pool_info = arm_compute::PoolingLayerInfo(arm_compute::PoolingType::AVG,
-                                                        arm_compute::Size2D(filter_width,filter_height),
-                                                        pad_info, true);
+  arm_compute::PoolingLayerInfo pool_info = arm_compute::PoolingLayerInfo(
+      arm_compute::PoolingType::AVG, arm_compute::Size2D(filter_width, filter_height), pad_info,
+      true);
 
   CLUniqueTensor input(arm_compute::TensorInfo(input_shape, arm_compute::Format::F32));
   CLUniqueTensor output(arm_compute::TensorInfo(output_shape, arm_compute::Format::F32));
@@ -109,7 +107,8 @@ bool averagePoolFloat32(const float* inputData, const nnfw::rt::Shape& inputShap
   input.allocate();
   output.allocate();
 
-  util::insertFusedActivationLayer<CLUniqueTensor, arm_compute::CLActivationLayer>(output, activation, fns);
+  util::insertFusedActivationLayer<CLUniqueTensor, arm_compute::CLActivationLayer>(output,
+                                                                                   activation, fns);
 
   TensorAccess<InputAccessor>(input.ref(), inputData, inputShape);
 
index 8112e7a..0971e21 100644 (file)
@@ -26,8 +26,8 @@ using namespace nnfw::kernel::acl;
 
 TEST(KernelACL_TC, maxPoolFloat32_3x3to1x1)
 {
-  util::TensorWrapper input({1,3,3,1});
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  util::TensorWrapper input({1, 3, 3, 1});
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   int32_t padding_left = 0;
   int32_t padding_right = 0;
   int32_t padding_top = 0;
@@ -38,36 +38,30 @@ TEST(KernelACL_TC, maxPoolFloat32_3x3to1x1)
   int32_t filter_height = 3;
 
   float outputData[1];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,1,1,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 1, 1, 1}, 1.0, 0};
   bool bret;
 
   float value = 1.0f;
-  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return value++;
-  });
+  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return value++; });
 
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bret = maxPoolFloat32(input.ptr<float>(), inputShape,
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    outputData, outputShape);
+  bret = maxPoolFloat32(input.ptr<float>(), inputShape, padding_left, padding_right, padding_top,
+                        padding_bottom, stride_width, stride_height, filter_width, filter_height,
+                        activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = { 9.0f };
+  float expectData[] = {9.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
 
 TEST(KernelACL_TC, maxPoolFloat32_3x3to1x1_RELU)
 {
-  util::TensorWrapper input({1,3,3,1});
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  util::TensorWrapper input({1, 3, 3, 1});
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   int32_t padding_left = 0;
   int32_t padding_right = 0;
   int32_t padding_top = 0;
@@ -78,36 +72,30 @@ TEST(KernelACL_TC, maxPoolFloat32_3x3to1x1_RELU)
   int32_t filter_height = 3;
 
   float outputData[1];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,1,1,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 1, 1, 1}, 1.0, 0};
   bool bret;
 
   float value = -1.0f;
-  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return value--;
-  });
+  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return value--; });
 
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
   int32_t activation = ANEURALNETWORKS_FUSED_RELU;
 
-  bret = maxPoolFloat32(input.ptr<float>(), inputShape,
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    outputData, outputShape);
+  bret = maxPoolFloat32(input.ptr<float>(), inputShape, padding_left, padding_right, padding_top,
+                        padding_bottom, stride_width, stride_height, filter_width, filter_height,
+                        activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = { 0.0f };
+  float expectData[] = {0.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
 
 TEST(KernelACL_TC, maxPoolFloat32_3x3to2x2)
 {
-  util::TensorWrapper input({1,3,3,1});
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  util::TensorWrapper input({1, 3, 3, 1});
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   int32_t padding_left = 0;
   int32_t padding_right = 1;
   int32_t padding_top = 0;
@@ -118,39 +106,30 @@ TEST(KernelACL_TC, maxPoolFloat32_3x3to2x2)
   int32_t filter_height = 2;
 
   float outputData[4];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,2,2,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 2, 2, 1}, 1.0, 0};
   bool bret;
 
   float value = 1.0f;
-  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return value++;
-  });
+  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return value++; });
 
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bret = maxPoolFloat32(input.ptr<float>(), inputShape,
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    outputData, outputShape);
+  bret = maxPoolFloat32(input.ptr<float>(), inputShape, padding_left, padding_right, padding_top,
+                        padding_bottom, stride_width, stride_height, filter_width, filter_height,
+                        activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = {
-    5.0f, 6.0f,
-    8.0f, 9.0f
-  };
+  float expectData[] = {5.0f, 6.0f, 8.0f, 9.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
 
 TEST(KernelACL_TC, maxPoolFloat32_147x147to73x73)
 {
-  util::TensorWrapper input({1,147,147,64});
-  util::TensorWrapper output({1,73,73,64});
+  util::TensorWrapper input({1, 147, 147, 64});
+  util::TensorWrapper output({1, 73, 73, 64});
 
   int32_t padding_left = 0;
   int32_t padding_right = 0;
@@ -161,37 +140,27 @@ TEST(KernelACL_TC, maxPoolFloat32_147x147to73x73)
   int32_t filter_width = 3;
   int32_t filter_height = 3;
 
-  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.0f;
-  });
+  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.0f; });
 
-  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 0.f;
-  });
+  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 0.f; });
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bool bret = maxPoolFloat32(input.ptr<float>(), input.shape(),
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    output.ptr<float>(), output.shape());
+  bool bret = maxPoolFloat32(input.ptr<float>(), input.shape(), padding_left, padding_right,
+                             padding_top, padding_bottom, stride_width, stride_height, filter_width,
+                             filter_height, activation, output.ptr<float>(), output.shape());
   EXPECT_EQ(bret, true);
 
-  util::TensorWrapper expected({1,73,73,64});
-  expected.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.0f;
-  });
+  util::TensorWrapper expected({1, 73, 73, 64});
+  expected.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.0f; });
 
   EXPECT_EQ(output, expected);
 }
 
 TEST(KernelACL_TC, maxPoolFloat32_71x71to35x35)
 {
-  util::TensorWrapper input({1,71,71,192});
-  util::TensorWrapper output({1,35,35,192});
+  util::TensorWrapper input({1, 71, 71, 192});
+  util::TensorWrapper output({1, 35, 35, 192});
 
   int32_t padding_left = 0;
   int32_t padding_right = 0;
@@ -202,37 +171,27 @@ TEST(KernelACL_TC, maxPoolFloat32_71x71to35x35)
   int32_t filter_width = 3;
   int32_t filter_height = 3;
 
-  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.0f;
-  });
+  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.0f; });
 
-  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 0.f;
-  });
+  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 0.f; });
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bool bret = maxPoolFloat32(input.ptr<float>(), input.shape(),
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    output.ptr<float>(), output.shape());
+  bool bret = maxPoolFloat32(input.ptr<float>(), input.shape(), padding_left, padding_right,
+                             padding_top, padding_bottom, stride_width, stride_height, filter_width,
+                             filter_height, activation, output.ptr<float>(), output.shape());
   EXPECT_EQ(bret, true);
 
-  util::TensorWrapper expected({1,35,35,192});
-  expected.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.0f;
-  });
+  util::TensorWrapper expected({1, 35, 35, 192});
+  expected.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.0f; });
 
   EXPECT_EQ(output, expected);
 }
 
 TEST(KernelACL_TC, averagePoolFloat32_3x3to1x1)
 {
-  util::TensorWrapper input({1,3,3,1});
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  util::TensorWrapper input({1, 3, 3, 1});
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   int32_t padding_left = 0;
   int32_t padding_right = 0;
   int32_t padding_top = 0;
@@ -243,36 +202,30 @@ TEST(KernelACL_TC, averagePoolFloat32_3x3to1x1)
   int32_t filter_height = 3;
 
   float outputData[1];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,1,1,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 1, 1, 1}, 1.0, 0};
   bool bret;
 
   float value = 1.0f;
-  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return value++;
-  });
+  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return value++; });
 
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bret = averagePoolFloat32(input.ptr<float>(), inputShape,
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    outputData, outputShape);
+  bret = averagePoolFloat32(input.ptr<float>(), inputShape, padding_left, padding_right,
+                            padding_top, padding_bottom, stride_width, stride_height, filter_width,
+                            filter_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = { 5.0f };
+  float expectData[] = {5.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
 
 TEST(KernelACL_TC, averagePoolFloat32_3x3to1x1_RELU)
 {
-  util::TensorWrapper input({1,3,3,1});
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  util::TensorWrapper input({1, 3, 3, 1});
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   int32_t padding_left = 0;
   int32_t padding_right = 0;
   int32_t padding_top = 0;
@@ -283,36 +236,30 @@ TEST(KernelACL_TC, averagePoolFloat32_3x3to1x1_RELU)
   int32_t filter_height = 3;
 
   float outputData[1];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,1,1,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 1, 1, 1}, 1.0, 0};
   bool bret;
 
   float value = 3.0f;
-  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return value--;
-  });
+  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return value--; });
 
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
   int32_t activation = ANEURALNETWORKS_FUSED_RELU;
 
-  bret = averagePoolFloat32(input.ptr<float>(), inputShape,
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    outputData, outputShape);
+  bret = averagePoolFloat32(input.ptr<float>(), inputShape, padding_left, padding_right,
+                            padding_top, padding_bottom, stride_width, stride_height, filter_width,
+                            filter_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = { 0.0f };
+  float expectData[] = {0.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
 
 TEST(KernelACL_TC, averagePoolFloat32_3x3to2x2)
 {
-  util::TensorWrapper input({1,3,3,1});
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  util::TensorWrapper input({1, 3, 3, 1});
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   int32_t padding_left = 0;
   int32_t padding_right = 0;
   int32_t padding_top = 0;
@@ -323,38 +270,29 @@ TEST(KernelACL_TC, averagePoolFloat32_3x3to2x2)
   int32_t filter_height = 2;
 
   float outputData[4];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,2,2,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 2, 2, 1}, 1.0, 0};
   bool bret;
 
   float value = 1.0f;
-  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return value++;
-  });
+  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return value++; });
 
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bret = averagePoolFloat32(input.ptr<float>(), inputShape,
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    outputData, outputShape);
+  bret = averagePoolFloat32(input.ptr<float>(), inputShape, padding_left, padding_right,
+                            padding_top, padding_bottom, stride_width, stride_height, filter_width,
+                            filter_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = {
-    3.0f, 4.0f,
-    6.0f, 7.0f
-  };  
+  float expectData[] = {3.0f, 4.0f, 6.0f, 7.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
 
 TEST(KernelACL_TC, averagePoolFloat32_3x3to3x3)
 {
-  std::vector<uint32_t> dims = {1,3,3,1};
+  std::vector<uint32_t> dims = {1, 3, 3, 1};
   util::TensorWrapper input(dims);
   util::TensorWrapper output(dims);
 
@@ -367,28 +305,21 @@ TEST(KernelACL_TC, averagePoolFloat32_3x3to3x3)
   int32_t filter_width = 3;
   int32_t filter_height = 3;
 
-  int32_t value=1.0f;
-  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return value++;
-  });
+  int32_t value = 1.0f;
+  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return value++; });
 
-  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 0.f;
-  });
+  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 0.f; });
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bool bret = averagePoolFloat32(input.ptr<float>(), input.shape(),
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    output.ptr<float>(), output.shape());
+  bool bret =
+      averagePoolFloat32(input.ptr<float>(), input.shape(), padding_left, padding_right,
+                         padding_top, padding_bottom, stride_width, stride_height, filter_width,
+                         filter_height, activation, output.ptr<float>(), output.shape());
   EXPECT_EQ(bret, true);
 
   util::TensorWrapper expected(dims);
-  float v=2.5f;
+  float v = 2.5f;
   expected.initValue([&v](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
     v = v + 0.5f;
     return v;
@@ -399,8 +330,8 @@ TEST(KernelACL_TC, averagePoolFloat32_3x3to3x3)
 
 TEST(KernelACL_TC, averagePoolFloat32_35x35to35x35)
 {
-  int32_t N=35;
-  std::vector<uint32_t> dims = {1,35,35,768};
+  int32_t N = 35;
+  std::vector<uint32_t> dims = {1, 35, 35, 768};
   util::TensorWrapper input(dims);
   util::TensorWrapper output(dims);
 
@@ -413,37 +344,28 @@ TEST(KernelACL_TC, averagePoolFloat32_35x35to35x35)
   int32_t filter_width = 3;
   int32_t filter_height = 3;
 
-  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.0f;
-  });
+  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.0f; });
 
-  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 0.f;
-  });
+  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 0.f; });
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bool bret = averagePoolFloat32(input.ptr<float>(), input.shape(),
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    output.ptr<float>(), output.shape());
+  bool bret =
+      averagePoolFloat32(input.ptr<float>(), input.shape(), padding_left, padding_right,
+                         padding_top, padding_bottom, stride_width, stride_height, filter_width,
+                         filter_height, activation, output.ptr<float>(), output.shape());
   EXPECT_EQ(bret, true);
 
   util::TensorWrapper expected(dims);
-  expected.initValue([&N](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-      return 1.0f;
-  });
+  expected.initValue([&N](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.0f; });
 
   EXPECT_EQ(output, expected);
 }
 
 TEST(KernelACL_TC, averagePoolFloat32_8x8to1x1)
 {
-  util::TensorWrapper input({1,8,8,2048});
-  util::TensorWrapper output({1,1,1,2048});
+  util::TensorWrapper input({1, 8, 8, 2048});
+  util::TensorWrapper output({1, 1, 1, 2048});
 
   int32_t padding_left = 0;
   int32_t padding_right = 0;
@@ -454,29 +376,20 @@ TEST(KernelACL_TC, averagePoolFloat32_8x8to1x1)
   int32_t filter_width = 8;
   int32_t filter_height = 8;
 
-  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.0f;
-  });
+  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.0f; });
 
-  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 0.f;
-  });
+  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 0.f; });
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bool bret = averagePoolFloat32(input.ptr<float>(), input.shape(),
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    output.ptr<float>(), output.shape());
+  bool bret =
+      averagePoolFloat32(input.ptr<float>(), input.shape(), padding_left, padding_right,
+                         padding_top, padding_bottom, stride_width, stride_height, filter_width,
+                         filter_height, activation, output.ptr<float>(), output.shape());
   EXPECT_EQ(bret, true);
 
-  util::TensorWrapper expected({1,1,1,2048});
-  expected.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.0f;
-  });
+  util::TensorWrapper expected({1, 1, 1, 2048});
+  expected.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.0f; });
 
   EXPECT_EQ(output, expected);
 }
index 69e2fdf..707333e 100644 (file)
 #include "../UniqueTensor.h"
 #include "../Reshape.h"
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
 
-static void sync_scheduler() {
-  arm_compute::CLScheduler::get().sync();
-}
+static void sync_scheduler() { arm_compute::CLScheduler::get().sync(); }
 
-bool reshapeGeneric(const void* inputData, const nnfw::rt::Shape& inputShape,
-                    void* outputData, const nnfw::rt::Shape& outputShape) {
-  return common::reshapeGeneric<CLUniqueTensor, arm_compute::CLReshapeLayer>
-    (inputData, inputShape, outputData, outputShape, sync_scheduler);
+bool reshapeGeneric(const void *inputData, const nnfw::rt::Shape &inputShape, void *outputData,
+                    const nnfw::rt::Shape &outputShape)
+{
+  return common::reshapeGeneric<CLUniqueTensor, arm_compute::CLReshapeLayer>(
+      inputData, inputShape, outputData, outputShape, sync_scheduler);
 }
 
 } // namespace acl
index 1b2a336..09a430a 100644 (file)
 #include "../UniqueTensor.h"
 #include "../util.h"
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
 
-bool softmaxFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
-                    const float beta,
-                    float* outputData, const nnfw::rt::Shape& outputShape)
+bool softmaxFloat32(const float *inputData, const nnfw::rt::Shape &inputShape, const float beta,
+                    float *outputData, const nnfw::rt::Shape &outputShape)
 {
   arm_compute::TensorShape input_shape = util::fromNNShape(inputShape);
   arm_compute::TensorShape output_shape = util::fromNNShape(outputShape);
index 8ee8b41..d121314 100644 (file)
@@ -27,9 +27,9 @@ using namespace nnfw::kernel::acl;
 TEST(KernelACL_TC, softmaxFloat32_1xn)
 {
   float inputData[4];
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,4}, 1.0, 0 };
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 4}, 1.0, 0};
   float outputData[4];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,4}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 4}, 1.0, 0};
   const float beta = 1.0f;
   bool bret;
 
@@ -39,7 +39,7 @@ TEST(KernelACL_TC, softmaxFloat32_1xn)
   bret = softmaxFloat32(inputData, inputShape, beta, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = { 0.25f, 0.25f, 0.25f, 0.25f };
+  float expectData[] = {0.25f, 0.25f, 0.25f, 0.25f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
@@ -47,9 +47,9 @@ TEST(KernelACL_TC, softmaxFloat32_1xn)
 TEST(KernelACL_TC, softmaxFloat32_4d)
 {
   float inputData[4];
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,1,4,1}, 1.0, 0 };
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 1, 4, 1}, 1.0, 0};
   float outputData[4];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,1,4,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 1, 4, 1}, 1.0, 0};
   const float beta = 1.0f;
   bool bret;
 
@@ -59,7 +59,7 @@ TEST(KernelACL_TC, softmaxFloat32_4d)
   bret = softmaxFloat32(inputData, inputShape, beta, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = { 0.25f, 0.25f, 0.25f, 0.25f };
+  float expectData[] = {0.25f, 0.25f, 0.25f, 0.25f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
@@ -67,9 +67,9 @@ TEST(KernelACL_TC, softmaxFloat32_4d)
 TEST(KernelACL_TC, softmaxFloat32_1xn_seq)
 {
   float inputData[4];
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,4}, 1.0, 0 };
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 4}, 1.0, 0};
   float outputData[4];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,4}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 4}, 1.0, 0};
   const float beta = 1.0f;
   bool bret;
 
@@ -87,9 +87,9 @@ TEST(KernelACL_TC, softmaxFloat32_1xn_seq)
 TEST(KernelACL_TC, softmaxFloat32_4d_seq)
 {
   float inputData[4];
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,1,4,1}, 1.0, 0 };
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 1, 4, 1}, 1.0, 0};
   float outputData[4];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,1,4,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 1, 4, 1}, 1.0, 0};
   const float beta = 1.0f;
   bool bret;
 
index f6fc52f..d17fcbe 100644 (file)
@@ -22,10 +22,7 @@ class TestEnvironment : public ::testing::Environment
 public:
   virtual ~TestEnvironment() = default;
 
-  virtual void SetUp()
-  {
-    nnfw::kernel::acl::Initialize();
-  }
+  virtual void SetUp() { nnfw::kernel::acl::Initialize(); }
 
   virtual void TearDown()
   {
@@ -33,5 +30,5 @@ public:
   }
 };
 
-static ::testing::Environmentconst testingenv =
-  ::testing::AddGlobalTestEnvironment(new TestEnvironment);
+static ::testing::Environment *const testingenv =
+    ::testing::AddGlobalTestEnvironment(new TestEnvironment);
index 8738a9d..2b494eb 100644 (file)
 #include "../IO_accessor.h"
 #include "../shape.h"
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
-namespace neon {
-
-bool concatenationFloat32(const std::vector<const float*>& inputDataPtrs,
-                          const std::vector<nnfw::rt::Shape>& inputShapes, int32_t axis,
-                          float* outputData, const nnfw::rt::Shape& outputShape)
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
+namespace neon
+{
+
+bool concatenationFloat32(const std::vector<const float *> &inputDataPtrs,
+                          const std::vector<nnfw::rt::Shape> &inputShapes, int32_t axis,
+                          float *outputData, const nnfw::rt::Shape &outputShape)
 {
   if (axis != 3)
   {
@@ -40,17 +44,17 @@ bool concatenationFloat32(const std::vector<const float*>& inputDataPtrs,
   }
   assert(inputDataPtrs.size() == inputShapes.size());
 
-  std::vector<arm_compute::Tensor*> inputPtrs;
-  std::vector<arm_compute::ITensor*> inputIptrs;
+  std::vector<arm_compute::Tensor *> inputPtrs;
+  std::vector<arm_compute::ITensor *> inputIptrs;
   arm_compute::Tensor output;
 
   // init Tensors
   std::vector<nnfw::rt::Shape>::const_iterator it_inputShape = inputShapes.begin();
   for (auto inputData : inputDataPtrs)
   {
-    const nnfw::rt::ShapeinputShape = *it_inputShape;
+    const nnfw::rt::Shape &inputShape = *it_inputShape;
     arm_compute::TensorShape input_shape = util::fromNNShape(inputShape);
-    arm_compute::TensorinputPtr = new arm_compute::Tensor();
+    arm_compute::Tensor *inputPtr = new arm_compute::Tensor();
 
     inputPtr->allocator()->init(arm_compute::TensorInfo(input_shape, arm_compute::Format::F32));
     inputPtrs.push_back(inputPtr);
@@ -67,13 +71,13 @@ bool concatenationFloat32(const std::vector<const float*>& inputDataPtrs,
 
   // allocate Tensors
   it_inputShape = inputShapes.begin();
-  std::vector<const float*>::const_iterator it_inputData = inputDataPtrs.begin();
+  std::vector<const float *>::const_iterator it_inputData = inputDataPtrs.begin();
   for (auto inputPtr : inputPtrs)
   {
     inputPtr->allocator()->allocate();
 
-    const floatinputData = *it_inputData;
-    const nnfw::rt::ShapeinputShape = *it_inputShape;
+    const float *inputData = *it_inputData;
+    const nnfw::rt::Shape &inputShape = *it_inputShape;
 
     TensorAccess<InputAccessor>(*inputPtr, inputData, inputShape);
 
index 03b05bd..4fe2451 100644 (file)
@@ -27,17 +27,17 @@ using namespace nnfw::kernel::acl;
 TEST(KernelACL_TC, neon_concatFloat32_1)
 {
   float inputData_1[6] = {
-    1, 2, 3, 4, 5, 6      // [ [ [1],[2],[3] ], [ [4],[5],[6] ] ]
+      1, 2, 3, 4, 5, 6 // [ [ [1],[2],[3] ], [ [4],[5],[6] ] ]
   };
   float inputData_2[6] = {
-    7, 8, 9, 10, 11, 12   // [ [ [7],[8],[9] ], [ [10],[11],[12] ] ]
+      7, 8, 9, 10, 11, 12 // [ [ [7],[8],[9] ], [ [10],[11],[12] ] ]
   };
-  const nnfw::rt::Shape inputShape_1 = { OperandType::FLOAT32, {1,2,3,1}, 1.0, 0 };
-  const nnfw::rt::Shape inputShape_2 = { OperandType::FLOAT32, {1,2,3,1}, 1.0, 0 };
-  std::vector<const float*> inputDataPtrs;
+  const nnfw::rt::Shape inputShape_1 = {OperandType::FLOAT32, {1, 2, 3, 1}, 1.0, 0};
+  const nnfw::rt::Shape inputShape_2 = {OperandType::FLOAT32, {1, 2, 3, 1}, 1.0, 0};
+  std::vector<const float *> inputDataPtrs;
   std::vector<nnfw::rt::Shape> inputShapes;
   float outputData[12];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,2,3,2}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 2, 3, 2}, 1.0, 0};
   bool bret;
 
   inputDataPtrs.push_back(inputData_1);
@@ -47,14 +47,10 @@ TEST(KernelACL_TC, neon_concatFloat32_1)
 
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
-  bret = neon::concatenationFloat32(inputDataPtrs, inputShapes, 3, 
-                                    outputData, outputShape);
+  bret = neon::concatenationFloat32(inputDataPtrs, inputShapes, 3, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectNCHW[] = {
-    1, 2, 3, 4, 5, 6,
-    7, 8, 9, 10, 11, 12
-  };
+  float expectNCHW[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
   float expectData[12]; // [ [ [1,7],[2,8],[3,9] ], [ [4,10],[5,11],[6,12] ] ]
   util::NCHW2NHWC(expectNCHW, expectData, outputShape);
   bret = util::compareData(outputData, expectData, outputShape);
index 8c0e8a4..87372d7 100644 (file)
 
 #include "support/nnapi/feature/Reader.h"
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
-namespace neon {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
+namespace neon
+{
 
 static int verbose = 0;
 
-bool convFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
-                 const float* filterData, const nnfw::rt::Shape& filterShape,
-                 const float* biasData, const nnfw::rt::Shape& biasShape,
-                 int32_t padding_left, int32_t padding_right,
-                 int32_t padding_top, int32_t padding_bottom,
-                 int32_t stride_width, int32_t stride_height,
-                 int32_t activation,
-                 float* outputData, const nnfw::rt::Shape& outputShape)
+bool convFloat32(const float *inputData, const nnfw::rt::Shape &inputShape, const float *filterData,
+                 const nnfw::rt::Shape &filterShape, const float *biasData,
+                 const nnfw::rt::Shape &biasShape, int32_t padding_left, int32_t padding_right,
+                 int32_t padding_top, int32_t padding_bottom, int32_t stride_width,
+                 int32_t stride_height, int32_t activation, float *outputData,
+                 const nnfw::rt::Shape &outputShape)
 {
   arm_compute::TensorShape input_shape = util::fromNNShape(inputShape);
   arm_compute::TensorShape filter_shape = util::fromNNShape(filterShape);
   arm_compute::TensorShape bias_shape = util::fromVectorNNShape(biasShape);
   arm_compute::TensorShape output_shape = util::fromNNShape(outputShape);
-  arm_compute::PadStrideInfo conv_info = arm_compute::PadStrideInfo(stride_width, stride_height,
-                                              padding_left, padding_right,
-                                              padding_top, padding_bottom,
-                                              arm_compute::DimensionRoundingType::FLOOR);
+  arm_compute::PadStrideInfo conv_info = arm_compute::PadStrideInfo(
+      stride_width, stride_height, padding_left, padding_right, padding_top, padding_bottom,
+      arm_compute::DimensionRoundingType::FLOOR);
 
   NEUniqueTensor input(arm_compute::TensorInfo(input_shape, arm_compute::Format::F32));
   NEUniqueTensor output(arm_compute::TensorInfo(output_shape, arm_compute::Format::F32));
@@ -70,7 +71,8 @@ bool convFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
 
   fns.emplace_back(conv_f);
 
-  util::insertFusedActivationLayer<NEUniqueTensor, arm_compute::NEActivationLayer>(output, activation, fns);
+  util::insertFusedActivationLayer<NEUniqueTensor, arm_compute::NEActivationLayer>(output,
+                                                                                   activation, fns);
 
   input.allocate();
   output.allocate();
@@ -86,10 +88,11 @@ bool convFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
   {
     auto ifm_shape = nnfw::support::nnapi::feature::asFeatureShape(inputShape);
     nnfw::support::nnapi::feature::Reader<float> nnapi_ifm_reader{ifm_shape, inputData};
-    nnfw::support::acl::feature::Reader<float> acl_ifm_reader{ input.ptr() };
+    nnfw::support::acl::feature::Reader<float> acl_ifm_reader{input.ptr()};
 
     std::cout << "NNAPI IFM:" << std::endl;
-    std::cout << nnfw::util::feature::TextFormatter<float>{ifm_shape, nnapi_ifm_reader} << std::endl;
+    std::cout << nnfw::util::feature::TextFormatter<float>{ifm_shape, nnapi_ifm_reader}
+              << std::endl;
 
     std::cout << "ARM Compute IFM:" << std::endl;
     std::cout << nnfw::util::feature::TextFormatter<float>{ifm_shape, acl_ifm_reader} << std::endl;
index 6a3de1c..3adb938 100644 (file)
@@ -27,11 +27,11 @@ using namespace nnfw::kernel::acl;
 TEST(KernelACL_TC, neon_convFloat32_3x3to1x1)
 {
   float inputData[9];
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   float filterData[9];
-  const nnfw::rt::Shape filterShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
-  float biasData[1] = { 1.0 };
-  const nnfw::rt::Shape biasShape = { OperandType::FLOAT32, {1}, 1.0, 0 };
+  const nnfw::rt::Shape filterShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
+  float biasData[1] = {1.0};
+  const nnfw::rt::Shape biasShape = {OperandType::FLOAT32, {1}, 1.0, 0};
   int32_t padding_left = 0;
   int32_t padding_right = 0;
   int32_t padding_top = 0;
@@ -40,24 +40,19 @@ TEST(KernelACL_TC, neon_convFloat32_3x3to1x1)
   int32_t stride_height = 1;
   int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
   float outputData[1];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,1,1,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 1, 1, 1}, 1.0, 0};
   bool bret;
 
   util::initData(inputData, sizeof(inputData) / sizeof(inputData[0]), 1.0);
   util::initData(filterData, sizeof(filterData) / sizeof(filterData[0]), 1.0);
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
-  bret = neon::convFloat32(inputData, inputShape,
-                     filterData, filterShape,
-                     biasData, biasShape,
-                     padding_left, padding_right,
-                     padding_top, padding_bottom,
-                     stride_width, stride_height,
-                     activation,
-                     outputData, outputShape);
+  bret = neon::convFloat32(inputData, inputShape, filterData, filterShape, biasData, biasShape,
+                           padding_left, padding_right, padding_top, padding_bottom, stride_width,
+                           stride_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = { 10.0f };
+  float expectData[] = {10.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
@@ -65,11 +60,11 @@ TEST(KernelACL_TC, neon_convFloat32_3x3to1x1)
 TEST(KernelACL_TC, neon_convFloat32_3x3to3x3)
 {
   float inputData[9];
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   float filterData[9];
-  const nnfw::rt::Shape filterShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
-  float biasData[1] = { 1.0 };
-  const nnfw::rt::Shape biasShape = { OperandType::FLOAT32, {1}, 1.0, 0 };
+  const nnfw::rt::Shape filterShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
+  float biasData[1] = {1.0};
+  const nnfw::rt::Shape biasShape = {OperandType::FLOAT32, {1}, 1.0, 0};
   int32_t padding_left = 1;
   int32_t padding_right = 1;
   int32_t padding_top = 1;
@@ -78,28 +73,19 @@ TEST(KernelACL_TC, neon_convFloat32_3x3to3x3)
   int32_t stride_height = 1;
   int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
   float outputData[9];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   bool bret;
 
   util::initData(inputData, sizeof(inputData) / sizeof(inputData[0]), 1.0);
   util::initData(filterData, sizeof(filterData) / sizeof(filterData[0]), 1.0);
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
-  bret = neon::convFloat32(inputData, inputShape,
-                     filterData, filterShape,
-                     biasData, biasShape,
-                     padding_left, padding_right,
-                     padding_top, padding_bottom,
-                     stride_width, stride_height,
-                     activation,
-                     outputData, outputShape);
+  bret = neon::convFloat32(inputData, inputShape, filterData, filterShape, biasData, biasShape,
+                           padding_left, padding_right, padding_top, padding_bottom, stride_width,
+                           stride_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = {
-    5.0f, 7.0f, 5.0f,
-    7.0f, 10.0f, 7.0f,
-    5.0f, 7.0f, 5.0f
-  };
+  float expectData[] = {5.0f, 7.0f, 5.0f, 7.0f, 10.0f, 7.0f, 5.0f, 7.0f, 5.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
@@ -107,11 +93,11 @@ TEST(KernelACL_TC, neon_convFloat32_3x3to3x3)
 TEST(KernelACL_TC, neon_convFloat32_3x3to3x3_RELU)
 {
   float inputData[9];
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   float filterData[9];
-  const nnfw::rt::Shape filterShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
-  float biasData[1] = { -5.0f };
-  const nnfw::rt::Shape biasShape = { OperandType::FLOAT32, {1}, 1.0, 0 };
+  const nnfw::rt::Shape filterShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
+  float biasData[1] = {-5.0f};
+  const nnfw::rt::Shape biasShape = {OperandType::FLOAT32, {1}, 1.0, 0};
   int32_t padding_left = 1;
   int32_t padding_right = 1;
   int32_t padding_top = 1;
@@ -120,29 +106,19 @@ TEST(KernelACL_TC, neon_convFloat32_3x3to3x3_RELU)
   int32_t stride_height = 1;
   int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
   float outputData[9];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   bool bret;
 
   util::initData(inputData, sizeof(inputData) / sizeof(inputData[0]), 1.0);
   util::initData(filterData, sizeof(filterData) / sizeof(filterData[0]), 1.0);
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
-  bret = neon::convFloat32(inputData, inputShape,
-                     filterData, filterShape,
-                     biasData, biasShape,
-                     padding_left, padding_right,
-                     padding_top, padding_bottom,
-                     stride_width, stride_height,
-                     activation,
-                     outputData, outputShape);
+  bret = neon::convFloat32(inputData, inputShape, filterData, filterShape, biasData, biasShape,
+                           padding_left, padding_right, padding_top, padding_bottom, stride_width,
+                           stride_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] =
-  {
-    0.0f, 1.0f, 0.0f,
-    1.0f, 4.0f, 1.0f,
-    0.0f, 1.0f, 0.0f
-  };
+  float expectData[] = {0.0f, 1.0f, 0.0f, 1.0f, 4.0f, 1.0f, 0.0f, 1.0f, 0.0f};
 
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
@@ -150,19 +126,12 @@ TEST(KernelACL_TC, neon_convFloat32_3x3to3x3_RELU)
 
 TEST(KernelACL_TC, neon_convFloat32_3x5to3x3)
 {
-  float inputData[15] = {
-    1,2,3,4,5,
-    6,7,8,9,10,
-    11,12,13,14,15
-  };
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,5,1}, 1.0, 0 };
-  float filterData[18] = {
-    1,1,1, 1,1,1, 1,1,1,
-    2,2,2, 2,2,2, 2,2,2
-  };
-  const nnfw::rt::Shape filterShape = { OperandType::FLOAT32, {2,3,3,1}, 1.0, 0 };
-  float biasData[2] = { 1.0, 1.0 };
-  const nnfw::rt::Shape biasShape = { OperandType::FLOAT32, {2}, 1.0, 0 };
+  float inputData[15] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 5, 1}, 1.0, 0};
+  float filterData[18] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2};
+  const nnfw::rt::Shape filterShape = {OperandType::FLOAT32, {2, 3, 3, 1}, 1.0, 0};
+  float biasData[2] = {1.0, 1.0};
+  const nnfw::rt::Shape biasShape = {OperandType::FLOAT32, {2}, 1.0, 0};
   int32_t padding_left = 1;
   int32_t padding_right = 1;
   int32_t padding_top = 1;
@@ -171,30 +140,21 @@ TEST(KernelACL_TC, neon_convFloat32_3x5to3x3)
   int32_t stride_height = 1;
   int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
   float outputData[30];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,3,5,2}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 3, 5, 2}, 1.0, 0};
   bool bret;
 
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
-  bret = neon::convFloat32(inputData, inputShape,
-                     filterData, filterShape,
-                     biasData, biasShape,
-                     padding_left, padding_right,
-                     padding_top, padding_bottom,
-                     stride_width, stride_height,
-                     activation,
-                     outputData, outputShape);
+  bret = neon::convFloat32(inputData, inputShape, filterData, filterShape, biasData, biasShape,
+                           padding_left, padding_right, padding_top, padding_bottom, stride_width,
+                           stride_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectNCHW[] = {
-    17.0f, 28.0f, 34.0f, 40.0f, 29.0f,
-    40.0f, 64.0f, 73.0f, 82.0f, 58.0f,
-    37.0f, 58.0f, 64.0f, 70.0f, 49.0f,
+  float expectNCHW[] = {17.0f,  28.0f,  34.0f, 40.0f,  29.0f,  40.0f,  64.0f,  73.0f,
+                        82.0f,  58.0f,  37.0f, 58.0f,  64.0f,  70.0f,  49.0f,
 
-    33.0f, 55.0f, 67.0f, 79.0f, 57.0f,
-    79.0f, 127.0f, 145.0f, 163.0f, 115.0f,
-    73.0f, 115.0f, 127.0f, 139.0f, 97.0f
-  };
+                        33.0f,  55.0f,  67.0f, 79.0f,  57.0f,  79.0f,  127.0f, 145.0f,
+                        163.0f, 115.0f, 73.0f, 115.0f, 127.0f, 139.0f, 97.0f};
   float expectData[30];
   util::NCHW2NHWC(expectNCHW, expectData, outputShape);
   bret = util::compareData(outputData, expectData, outputShape);
index 94ca085..b40a65c 100644 (file)
 #include "../UniqueTensor.h"
 #include "../DepthwiseConv2D.h"
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
 
-namespace neon {
-static void sync_scheduler() {
-}
+namespace neon
+{
+static void sync_scheduler() {}
 
-bool depthwiseConvFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
-                          const float* filterData, const nnfw::rt::Shape& filterShape,
-                          const float* biasData, const nnfw::rt::Shape& biasShape,
-                          int32_t padding_left, int32_t padding_right,
-                          int32_t padding_top, int32_t padding_bottom,
-                          int32_t stride_width, int32_t stride_height,
-                          int32_t depth_multiplier, int32_t activation,
-                          float* outputData, const nnfw::rt::Shape& outputShape) {
+bool depthwiseConvFloat32(const float *inputData, const nnfw::rt::Shape &inputShape,
+                          const float *filterData, const nnfw::rt::Shape &filterShape,
+                          const float *biasData, const nnfw::rt::Shape &biasShape,
+                          int32_t padding_left, int32_t padding_right, int32_t padding_top,
+                          int32_t padding_bottom, int32_t stride_width, int32_t stride_height,
+                          int32_t depth_multiplier, int32_t activation, float *outputData,
+                          const nnfw::rt::Shape &outputShape)
+{
   return common::depthwiseConvFloat32<NEUniqueTensor, arm_compute::NEDepthwiseConvolutionLayer,
-  arm_compute::NEActivationLayer>(inputData, inputShape,
-      filterData, filterShape,
-      biasData, biasShape,
-      padding_left, padding_right,
-      padding_top, padding_bottom,
-      stride_width, stride_height,
-      depth_multiplier, activation,
-      outputData, outputShape,
-      sync_scheduler);
+                                      arm_compute::NEActivationLayer>(
+      inputData, inputShape, filterData, filterShape, biasData, biasShape, padding_left,
+      padding_right, padding_top, padding_bottom, stride_width, stride_height, depth_multiplier,
+      activation, outputData, outputShape, sync_scheduler);
 }
 
 } // namespace neon
index 397dd17..c245925 100644 (file)
 #include "../UniqueTensor.h"
 #include "../FullyConnected.h"
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
 
-namespace neon {
+namespace neon
+{
 
-void sync_scheduler() {
-}
+void sync_scheduler() {}
 
-bool fullyConnectedFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
-                           const float* weightsData, const nnfw::rt::Shape& weightsShape,
-                           const float* biasData, const nnfw::rt::Shape& biasShape,
-                           int32_t activation,
-                           float* outputData, const nnfw::rt::Shape& outputShape) {
+bool fullyConnectedFloat32(const float *inputData, const nnfw::rt::Shape &inputShape,
+                           const float *weightsData, const nnfw::rt::Shape &weightsShape,
+                           const float *biasData, const nnfw::rt::Shape &biasShape,
+                           int32_t activation, float *outputData,
+                           const nnfw::rt::Shape &outputShape)
+{
 
   return common::fullyConnectedFloat32<NEUniqueTensor, arm_compute::NEFullyConnectedLayer,
-            arm_compute::NEActivationLayer>(inputData, inputShape,
-      weightsData, weightsShape,
-      biasData, biasShape,
-      activation,
-      outputData, outputShape,
-      sync_scheduler);
+                                       arm_compute::NEActivationLayer>(
+      inputData, inputShape, weightsData, weightsShape, biasData, biasShape, activation, outputData,
+      outputShape, sync_scheduler);
 }
 
 } // namespace neon
 } // namespace acl
 } // namespace kernel
 } // namespace nnfw
-
index d4c95e4..baf0681 100644 (file)
@@ -18,4 +18,3 @@
 #define ACL_TEST(tc, t) TEST(tc, neon_##t)
 
 #include "../FullyConnected.test.h"
-
index 0cf5831..d1665e5 100644 (file)
 
 #include <cassert>
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
-namespace neon {
-
-bool maxPoolFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
-                 int32_t padding_left, int32_t padding_right,
-                 int32_t padding_top, int32_t padding_bottom,
-                 int32_t stride_width, int32_t stride_height,
-                 int32_t filter_width, int32_t filter_height,
-                 int32_t activation,
-                 float* outputData, const nnfw::rt::Shape& outputShape)
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
+namespace neon
+{
+
+bool maxPoolFloat32(const float *inputData, const nnfw::rt::Shape &inputShape, int32_t padding_left,
+                    int32_t padding_right, int32_t padding_top, int32_t padding_bottom,
+                    int32_t stride_width, int32_t stride_height, int32_t filter_width,
+                    int32_t filter_height, int32_t activation, float *outputData,
+                    const nnfw::rt::Shape &outputShape)
 {
   arm_compute::TensorShape input_shape = util::fromNNShape(inputShape);
   arm_compute::TensorShape output_shape = util::fromNNShape(outputShape);
 
   std::vector<std::shared_ptr<arm_compute::IFunction>> fns;
 
-  arm_compute::PadStrideInfo pad_info = arm_compute::PadStrideInfo(stride_width, stride_height,
-                                              padding_left, padding_right,
-                                              padding_top, padding_bottom,
-                                              arm_compute::DimensionRoundingType::FLOOR);
+  arm_compute::PadStrideInfo pad_info = arm_compute::PadStrideInfo(
+      stride_width, stride_height, padding_left, padding_right, padding_top, padding_bottom,
+      arm_compute::DimensionRoundingType::FLOOR);
 
-  arm_compute::PoolingLayerInfo maxpool_info = arm_compute::PoolingLayerInfo(arm_compute::PoolingType::MAX,
-                                                        arm_compute::Size2D(filter_width,filter_height),
-                                                        pad_info, false);
+  arm_compute::PoolingLayerInfo maxpool_info = arm_compute::PoolingLayerInfo(
+      arm_compute::PoolingType::MAX, arm_compute::Size2D(filter_width, filter_height), pad_info,
+      false);
 
   NEUniqueTensor input(arm_compute::TensorInfo(input_shape, arm_compute::Format::F32));
   NEUniqueTensor output(arm_compute::TensorInfo(output_shape, arm_compute::Format::F32));
@@ -58,7 +59,8 @@ bool maxPoolFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
 
   fns.emplace_back(pool_f);
 
-  util::insertFusedActivationLayer<NEUniqueTensor, arm_compute::NEActivationLayer>(output, activation, fns);
+  util::insertFusedActivationLayer<NEUniqueTensor, arm_compute::NEActivationLayer>(output,
+                                                                                   activation, fns);
 
   input.allocate();
   output.allocate();
@@ -75,27 +77,24 @@ bool maxPoolFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
   return true;
 }
 
-bool averagePoolFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
-                 int32_t padding_left, int32_t padding_right,
-                 int32_t padding_top, int32_t padding_bottom,
-                 int32_t stride_width, int32_t stride_height,
-                 int32_t filter_width, int32_t filter_height,
-                 int32_t activation,
-                 float* outputData, const nnfw::rt::Shape& outputShape)
+bool averagePoolFloat32(const float *inputData, const nnfw::rt::Shape &inputShape,
+                        int32_t padding_left, int32_t padding_right, int32_t padding_top,
+                        int32_t padding_bottom, int32_t stride_width, int32_t stride_height,
+                        int32_t filter_width, int32_t filter_height, int32_t activation,
+                        float *outputData, const nnfw::rt::Shape &outputShape)
 {
   arm_compute::TensorShape input_shape = util::fromNNShape(inputShape);
   arm_compute::TensorShape output_shape = util::fromNNShape(outputShape);
 
   std::vector<std::shared_ptr<arm_compute::IFunction>> fns;
 
-  arm_compute::PadStrideInfo pad_info = arm_compute::PadStrideInfo(stride_width, stride_height,
-                                              padding_left, padding_right,
-                                              padding_top, padding_bottom,
-                                              arm_compute::DimensionRoundingType::FLOOR);
+  arm_compute::PadStrideInfo pad_info = arm_compute::PadStrideInfo(
+      stride_width, stride_height, padding_left, padding_right, padding_top, padding_bottom,
+      arm_compute::DimensionRoundingType::FLOOR);
 
-  arm_compute::PoolingLayerInfo pool_info = arm_compute::PoolingLayerInfo(arm_compute::PoolingType::AVG,
-                                                        arm_compute::Size2D(filter_width,filter_height),
-                                                        pad_info, true);
+  arm_compute::PoolingLayerInfo pool_info = arm_compute::PoolingLayerInfo(
+      arm_compute::PoolingType::AVG, arm_compute::Size2D(filter_width, filter_height), pad_info,
+      true);
 
   NEUniqueTensor input(arm_compute::TensorInfo(input_shape, arm_compute::Format::F32));
   NEUniqueTensor output(arm_compute::TensorInfo(output_shape, arm_compute::Format::F32));
@@ -105,7 +104,8 @@ bool averagePoolFloat32(const float* inputData, const nnfw::rt::Shape& inputShap
 
   fns.emplace_back(pool_f);
 
-  util::insertFusedActivationLayer<NEUniqueTensor, arm_compute::NEActivationLayer>(output, activation, fns);
+  util::insertFusedActivationLayer<NEUniqueTensor, arm_compute::NEActivationLayer>(output,
+                                                                                   activation, fns);
 
   input.allocate();
   output.allocate();
index 4e65939..07159a6 100644 (file)
@@ -26,8 +26,8 @@ using namespace nnfw::kernel::acl;
 
 TEST(KernelACL_TC, neon_maxPoolFloat32_3x3to1x1)
 {
-  util::TensorWrapper input({1,3,3,1});
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  util::TensorWrapper input({1, 3, 3, 1});
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   int32_t padding_left = 0;
   int32_t padding_right = 0;
   int32_t padding_top = 0;
@@ -38,36 +38,30 @@ TEST(KernelACL_TC, neon_maxPoolFloat32_3x3to1x1)
   int32_t filter_height = 3;
 
   float outputData[1];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,1,1,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 1, 1, 1}, 1.0, 0};
   bool bret;
 
   float value = 1.0f;
-  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return value++;
-  });
+  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return value++; });
 
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bret = neon::maxPoolFloat32(input.ptr<float>(), inputShape,
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    outputData, outputShape);
+  bret = neon::maxPoolFloat32(input.ptr<float>(), inputShape, padding_left, padding_right,
+                              padding_top, padding_bottom, stride_width, stride_height,
+                              filter_width, filter_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = { 9.0f };
+  float expectData[] = {9.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
 
 TEST(KernelACL_TC, neon_maxPoolFloat32_3x3to1x1_RELU)
 {
-  util::TensorWrapper input({1,3,3,1});
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  util::TensorWrapper input({1, 3, 3, 1});
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   int32_t padding_left = 0;
   int32_t padding_right = 0;
   int32_t padding_top = 0;
@@ -78,36 +72,30 @@ TEST(KernelACL_TC, neon_maxPoolFloat32_3x3to1x1_RELU)
   int32_t filter_height = 3;
 
   float outputData[1];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,1,1,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 1, 1, 1}, 1.0, 0};
   bool bret;
 
   float value = -1.0f;
-  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return value--;
-  });
+  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return value--; });
 
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
   int32_t activation = ANEURALNETWORKS_FUSED_RELU;
 
-  bret = neon::maxPoolFloat32(input.ptr<float>(), inputShape,
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    outputData, outputShape);
+  bret = neon::maxPoolFloat32(input.ptr<float>(), inputShape, padding_left, padding_right,
+                              padding_top, padding_bottom, stride_width, stride_height,
+                              filter_width, filter_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = { 0.0f };
+  float expectData[] = {0.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
 
 TEST(KernelACL_TC, neon_maxPoolFloat32_3x3to2x2)
 {
-  util::TensorWrapper input({1,3,3,1});
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  util::TensorWrapper input({1, 3, 3, 1});
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   int32_t padding_left = 0;
   int32_t padding_right = 1;
   int32_t padding_top = 0;
@@ -118,39 +106,30 @@ TEST(KernelACL_TC, neon_maxPoolFloat32_3x3to2x2)
   int32_t filter_height = 2;
 
   float outputData[4];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,2,2,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 2, 2, 1}, 1.0, 0};
   bool bret;
 
   float value = 1.0f;
-  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return value++;
-  });
+  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return value++; });
 
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bret = neon::maxPoolFloat32(input.ptr<float>(), inputShape,
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    outputData, outputShape);
+  bret = neon::maxPoolFloat32(input.ptr<float>(), inputShape, padding_left, padding_right,
+                              padding_top, padding_bottom, stride_width, stride_height,
+                              filter_width, filter_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = {
-    5.0f, 6.0f,
-    8.0f, 9.0f
-  };
+  float expectData[] = {5.0f, 6.0f, 8.0f, 9.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
 
 TEST(KernelACL_TC, neon_maxPoolFloat32_147x147to73x73)
 {
-  util::TensorWrapper input({1,147,147,64});
-  util::TensorWrapper output({1,73,73,64});
+  util::TensorWrapper input({1, 147, 147, 64});
+  util::TensorWrapper output({1, 73, 73, 64});
 
   int32_t padding_left = 0;
   int32_t padding_right = 0;
@@ -161,37 +140,28 @@ TEST(KernelACL_TC, neon_maxPoolFloat32_147x147to73x73)
   int32_t filter_width = 3;
   int32_t filter_height = 3;
 
-  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.0f;
-  });
+  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.0f; });
 
-  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 0.f;
-  });
+  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 0.f; });
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bool bret = neon::maxPoolFloat32(input.ptr<float>(), input.shape(),
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    output.ptr<float>(), output.shape());
+  bool bret =
+      neon::maxPoolFloat32(input.ptr<float>(), input.shape(), padding_left, padding_right,
+                           padding_top, padding_bottom, stride_width, stride_height, filter_width,
+                           filter_height, activation, output.ptr<float>(), output.shape());
   EXPECT_EQ(bret, true);
 
-  util::TensorWrapper expected({1,73,73,64});
-  expected.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.0f;
-  });
+  util::TensorWrapper expected({1, 73, 73, 64});
+  expected.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.0f; });
 
   EXPECT_EQ(output, expected);
 }
 
 TEST(KernelACL_TC, neon_maxPoolFloat32_71x71to35x35)
 {
-  util::TensorWrapper input({1,71,71,192});
-  util::TensorWrapper output({1,35,35,192});
+  util::TensorWrapper input({1, 71, 71, 192});
+  util::TensorWrapper output({1, 35, 35, 192});
 
   int32_t padding_left = 0;
   int32_t padding_right = 0;
@@ -202,37 +172,28 @@ TEST(KernelACL_TC, neon_maxPoolFloat32_71x71to35x35)
   int32_t filter_width = 3;
   int32_t filter_height = 3;
 
-  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.0f;
-  });
+  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.0f; });
 
-  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 0.f;
-  });
+  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 0.f; });
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bool bret = neon::maxPoolFloat32(input.ptr<float>(), input.shape(),
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    output.ptr<float>(), output.shape());
+  bool bret =
+      neon::maxPoolFloat32(input.ptr<float>(), input.shape(), padding_left, padding_right,
+                           padding_top, padding_bottom, stride_width, stride_height, filter_width,
+                           filter_height, activation, output.ptr<float>(), output.shape());
   EXPECT_EQ(bret, true);
 
-  util::TensorWrapper expected({1,35,35,192});
-  expected.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.0f;
-  });
+  util::TensorWrapper expected({1, 35, 35, 192});
+  expected.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.0f; });
 
   EXPECT_EQ(output, expected);
 }
 
 TEST(KernelACL_TC, neon_averagePoolFloat32_3x3to1x1)
 {
-  util::TensorWrapper input({1,3,3,1});
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  util::TensorWrapper input({1, 3, 3, 1});
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   int32_t padding_left = 0;
   int32_t padding_right = 0;
   int32_t padding_top = 0;
@@ -243,36 +204,30 @@ TEST(KernelACL_TC, neon_averagePoolFloat32_3x3to1x1)
   int32_t filter_height = 3;
 
   float outputData[1];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,1,1,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 1, 1, 1}, 1.0, 0};
   bool bret;
 
   float value = 1.0f;
-  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return value++;
-  });
+  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return value++; });
 
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bret = neon::averagePoolFloat32(input.ptr<float>(), inputShape,
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    outputData, outputShape);
+  bret = neon::averagePoolFloat32(input.ptr<float>(), inputShape, padding_left, padding_right,
+                                  padding_top, padding_bottom, stride_width, stride_height,
+                                  filter_width, filter_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = { 5.0f };
+  float expectData[] = {5.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
 
 TEST(KernelACL_TC, neon_averagePoolFloat32_3x3to1x1_RELU)
 {
-  util::TensorWrapper input({1,3,3,1});
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  util::TensorWrapper input({1, 3, 3, 1});
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   int32_t padding_left = 0;
   int32_t padding_right = 0;
   int32_t padding_top = 0;
@@ -283,36 +238,30 @@ TEST(KernelACL_TC, neon_averagePoolFloat32_3x3to1x1_RELU)
   int32_t filter_height = 3;
 
   float outputData[1];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,1,1,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 1, 1, 1}, 1.0, 0};
   bool bret;
 
   float value = 3.0f;
-  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return value--;
-  });
+  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return value--; });
 
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
   int32_t activation = ANEURALNETWORKS_FUSED_RELU;
 
-  bret = neon::averagePoolFloat32(input.ptr<float>(), inputShape,
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    outputData, outputShape);
+  bret = neon::averagePoolFloat32(input.ptr<float>(), inputShape, padding_left, padding_right,
+                                  padding_top, padding_bottom, stride_width, stride_height,
+                                  filter_width, filter_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = { 0.0f };
+  float expectData[] = {0.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
 
 TEST(KernelACL_TC, neon_averagePoolFloat32_3x3to2x2)
 {
-  util::TensorWrapper input({1,3,3,1});
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
+  util::TensorWrapper input({1, 3, 3, 1});
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 3, 3, 1}, 1.0, 0};
   int32_t padding_left = 0;
   int32_t padding_right = 0;
   int32_t padding_top = 0;
@@ -323,38 +272,29 @@ TEST(KernelACL_TC, neon_averagePoolFloat32_3x3to2x2)
   int32_t filter_height = 2;
 
   float outputData[4];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,2,2,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 2, 2, 1}, 1.0, 0};
   bool bret;
 
   float value = 1.0f;
-  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return value++;
-  });
+  input.initValue([&value](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return value++; });
 
   util::initData(outputData, sizeof(outputData) / sizeof(outputData[0]), 0.0);
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bret = neon::averagePoolFloat32(input.ptr<float>(), inputShape,
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    outputData, outputShape);
+  bret = neon::averagePoolFloat32(input.ptr<float>(), inputShape, padding_left, padding_right,
+                                  padding_top, padding_bottom, stride_width, stride_height,
+                                  filter_width, filter_height, activation, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = {
-    3.0f, 4.0f,
-    6.0f, 7.0f
-  };
+  float expectData[] = {3.0f, 4.0f, 6.0f, 7.0f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
 
 TEST(KernelACL_TC, neon_averagePoolFloat32_35x35to35x35)
 {
-  std::vector<uint32_t> dims = {1,35,35,192};
+  std::vector<uint32_t> dims = {1, 35, 35, 192};
   util::TensorWrapper input(dims);
   util::TensorWrapper output(dims);
 
@@ -367,37 +307,28 @@ TEST(KernelACL_TC, neon_averagePoolFloat32_35x35to35x35)
   int32_t filter_width = 3;
   int32_t filter_height = 3;
 
-  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.0f;
-  });
+  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.0f; });
 
-  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 0.f;
-  });
+  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 0.f; });
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bool bret = neon::averagePoolFloat32(input.ptr<float>(), input.shape(),
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    output.ptr<float>(), output.shape());
+  bool bret = neon::averagePoolFloat32(input.ptr<float>(), input.shape(), padding_left,
+                                       padding_right, padding_top, padding_bottom, stride_width,
+                                       stride_height, filter_width, filter_height, activation,
+                                       output.ptr<float>(), output.shape());
   EXPECT_EQ(bret, true);
 
   util::TensorWrapper expected(dims);
-  expected.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-      return 1.0f;
-  });
+  expected.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.0f; });
 
   EXPECT_EQ(output, expected);
 }
 
 TEST(KernelACL_TC, neon_averagePoolFloat32_8x8to1x1)
 {
-  util::TensorWrapper input({1,8,8,2048});
-  util::TensorWrapper output({1,1,1,2048});
+  util::TensorWrapper input({1, 8, 8, 2048});
+  util::TensorWrapper output({1, 1, 1, 2048});
 
   int32_t padding_left = 0;
   int32_t padding_right = 0;
@@ -408,29 +339,20 @@ TEST(KernelACL_TC, neon_averagePoolFloat32_8x8to1x1)
   int32_t filter_width = 8;
   int32_t filter_height = 8;
 
-  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.0f;
-  });
+  input.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.0f; });
 
-  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 0.f;
-  });
+  output.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 0.f; });
 
   int32_t activation = ANEURALNETWORKS_FUSED_NONE;
 
-  bool bret = neon::averagePoolFloat32(input.ptr<float>(), input.shape(),
-                    padding_left, padding_right,
-                    padding_top, padding_bottom,
-                    stride_width, stride_height,
-                    filter_width, filter_height,
-                    activation,
-                    output.ptr<float>(), output.shape());
+  bool bret = neon::averagePoolFloat32(input.ptr<float>(), input.shape(), padding_left,
+                                       padding_right, padding_top, padding_bottom, stride_width,
+                                       stride_height, filter_width, filter_height, activation,
+                                       output.ptr<float>(), output.shape());
   EXPECT_EQ(bret, true);
 
-  util::TensorWrapper expected({1,1,1,2048});
-  expected.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) {
-    return 1.0f;
-  });
+  util::TensorWrapper expected({1, 1, 1, 2048});
+  expected.initValue([](uint32_t n, uint32_t c, uint32_t h, uint32_t w) { return 1.0f; });
 
   EXPECT_EQ(output, expected);
 }
index e7b0e77..4774dab 100644 (file)
 #include "../UniqueTensor.h"
 #include "../Reshape.h"
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
-
-namespace neon {
-
-static void sync_scheduler() {
-  arm_compute::CLScheduler::get().sync();
-}
-
-bool reshapeGeneric(const void* inputData, const nnfw::rt::Shape& inputShape,
-                    void* outputData, const nnfw::rt::Shape& outputShape) {
-  return common::reshapeGeneric<NEUniqueTensor, arm_compute::NEReshapeLayer>
-    (inputData, inputShape, outputData, outputShape, sync_scheduler);
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
+
+namespace neon
+{
+
+static void sync_scheduler() { arm_compute::CLScheduler::get().sync(); }
+
+bool reshapeGeneric(const void *inputData, const nnfw::rt::Shape &inputShape, void *outputData,
+                    const nnfw::rt::Shape &outputShape)
+{
+  return common::reshapeGeneric<NEUniqueTensor, arm_compute::NEReshapeLayer>(
+      inputData, inputShape, outputData, outputShape, sync_scheduler);
 }
 
 } // namespace neon
@@ -45,4 +48,3 @@ bool reshapeGeneric(const void* inputData, const nnfw::rt::Shape& inputShape,
 } // namespace acl
 } // namespace kernel
 } // namespace nnfw
-
index 6934485..49ad32e 100644 (file)
 #include "../util.h"
 #include "../UniqueTensor.h"
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
-namespace neon {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
+namespace neon
+{
 
-bool softmaxFloat32(const float* inputData, const nnfw::rt::Shape& inputShape,
-                    const float beta,
-                    float* outputData, const nnfw::rt::Shape& outputShape)
+bool softmaxFloat32(const float *inputData, const nnfw::rt::Shape &inputShape, const float beta,
+                    float *outputData, const nnfw::rt::Shape &outputShape)
 {
   arm_compute::TensorShape input_shape = util::fromNNShape(inputShape);
   arm_compute::TensorShape output_shape = util::fromNNShape(outputShape);
index 988f550..d33e476 100644 (file)
@@ -27,9 +27,9 @@ using namespace nnfw::kernel::acl;
 TEST(KernelACL_TC, neon_softmaxFloat32_1xn)
 {
   float inputData[4];
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,4}, 1.0, 0 };
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 4}, 1.0, 0};
   float outputData[4];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,4}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 4}, 1.0, 0};
   const float beta = 1.0f;
   bool bret;
 
@@ -39,7 +39,7 @@ TEST(KernelACL_TC, neon_softmaxFloat32_1xn)
   bret = neon::softmaxFloat32(inputData, inputShape, beta, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = { 0.25f, 0.25f, 0.25f, 0.25f };
+  float expectData[] = {0.25f, 0.25f, 0.25f, 0.25f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
@@ -47,9 +47,9 @@ TEST(KernelACL_TC, neon_softmaxFloat32_1xn)
 TEST(KernelACL_TC, neon_softmaxFloat32_4d)
 {
   float inputData[4];
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,1,4,1}, 1.0, 0 };
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 1, 4, 1}, 1.0, 0};
   float outputData[4];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,1,4,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 1, 4, 1}, 1.0, 0};
   const float beta = 1.0f;
   bool bret;
 
@@ -59,7 +59,7 @@ TEST(KernelACL_TC, neon_softmaxFloat32_4d)
   bret = neon::softmaxFloat32(inputData, inputShape, beta, outputData, outputShape);
   EXPECT_EQ(bret, true);
 
-  float expectData[] = { 0.25f, 0.25f, 0.25f, 0.25f };
+  float expectData[] = {0.25f, 0.25f, 0.25f, 0.25f};
   bret = util::compareData(outputData, expectData, outputShape);
   EXPECT_EQ(bret, true);
 }
@@ -67,9 +67,9 @@ TEST(KernelACL_TC, neon_softmaxFloat32_4d)
 TEST(KernelACL_TC, neon_softmaxFloat32_1xn_seq)
 {
   float inputData[4];
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,1,4,1}, 1.0, 0 };
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 1, 4, 1}, 1.0, 0};
   float outputData[4];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,1,4,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 1, 4, 1}, 1.0, 0};
   const float beta = 1.0f;
   bool bret;
 
@@ -87,9 +87,9 @@ TEST(KernelACL_TC, neon_softmaxFloat32_1xn_seq)
 TEST(KernelACL_TC, neon_softmaxFloat32_4d_seq)
 {
   float inputData[4];
-  const nnfw::rt::Shape inputShape = { OperandType::FLOAT32, {1,1,4,1}, 1.0, 0 };
+  const nnfw::rt::Shape inputShape = {OperandType::FLOAT32, {1, 1, 4, 1}, 1.0, 0};
   float outputData[4];
-  const nnfw::rt::Shape outputShape = { OperandType::FLOAT32, {1,1,4,1}, 1.0, 0 };
+  const nnfw::rt::Shape outputShape = {OperandType::FLOAT32, {1, 1, 4, 1}, 1.0, 0};
   const float beta = 1.0f;
   bool bret;
 
index 3c976ae..ff91a64 100644 (file)
 
 #include "shape.h"
 
-namespace nnfw {
-namespace rt {
+namespace nnfw
+{
+namespace rt
+{
 
 // TODO remove from this source and use it from runtime
-uint32_t getSizeOfDimension(const Shape& shape, uint32_t dimensionIdx) {
-    if (dimensionIdx >= shape.dimensions.size()) {
-        // TODO, log the error
-        return 0;
-    }
-    return shape.dimensions[dimensionIdx];
+uint32_t getSizeOfDimension(const Shape &shape, uint32_t dimensionIdx)
+{
+  if (dimensionIdx >= shape.dimensions.size())
+  {
+    // TODO, log the error
+    return 0;
+  }
+  return shape.dimensions[dimensionIdx];
 }
 
 } // namespace rt
 } // namespace nnfw
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
-namespace util {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
+namespace util
+{
 
-arm_compute::TensorShape fromVectorNNShape(const nnfw::rt::Shapeshape)
+arm_compute::TensorShape fromVectorNNShape(const nnfw::rt::Shape &shape)
 {
   assert(shape.dimensions.size() == 1);
 
@@ -47,7 +55,7 @@ arm_compute::TensorShape fromVectorNNShape(const nnfw::rt::Shape& shape)
   return arm_compute::TensorShape(len);
 }
 
-arm_compute::TensorShape fromMatrixNNShape(const nnfw::rt::Shapeshape)
+arm_compute::TensorShape fromMatrixNNShape(const nnfw::rt::Shape &shape)
 {
   assert(shape.dimensions.size() == 2);
 
@@ -57,11 +65,11 @@ arm_compute::TensorShape fromMatrixNNShape(const nnfw::rt::Shape& shape)
   return arm_compute::TensorShape(c, n);
 }
 
-arm_compute::TensorShape fromNNShape(const nnfw::rt::Shapeshape)
+arm_compute::TensorShape fromNNShape(const nnfw::rt::Shape &shape)
 {
-  if( shape.dimensions.size() == 1 )
+  if (shape.dimensions.size() == 1)
     return fromVectorNNShape(shape);
-  else if( shape.dimensions.size() == 2 )
+  else if (shape.dimensions.size() == 2)
     return fromMatrixNNShape(shape);
 
   // TODO: need to treat 3D tensors.
index 902115e..b70a2bb 100644 (file)
 #include <arm_compute/runtime/IFunction.h>
 #include <cassert>
 
-namespace nnfw {
-namespace rt {
+namespace nnfw
+{
+namespace rt
+{
 
 // TODO remove from this source and use it from runtime
-uint32_t getSizeOfDimension(const Shapeshape, uint32_t dimensionIdx);
+uint32_t getSizeOfDimension(const Shape &shape, uint32_t dimensionIdx);
 
 } // namespace rt
 } // namespace nnfw
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
-namespace util {
-
-arm_compute::TensorShape fromVectorNNShape(const nnfw::rt::Shape& shape);
-arm_compute::TensorShape fromNNShape(const nnfw::rt::Shape& shape);
-
-template<class TensorT, class ActT>
-void insertFusedActivationLayer(TensorT& out, int activation,
-    std::vector<std::shared_ptr<arm_compute::IFunction>>& fns) {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
+namespace util
+{
+
+arm_compute::TensorShape fromVectorNNShape(const nnfw::rt::Shape &shape);
+arm_compute::TensorShape fromNNShape(const nnfw::rt::Shape &shape);
+
+template <class TensorT, class ActT>
+void insertFusedActivationLayer(TensorT &out, int activation,
+                                std::vector<std::shared_ptr<arm_compute::IFunction>> &fns)
+{
   auto relu_f = std::make_shared<ActT>();
 
-  switch(activation) {
-  case ANEURALNETWORKS_FUSED_NONE:
-    // DO NOTHING
-    return;
+  switch (activation)
+  {
+    case ANEURALNETWORKS_FUSED_NONE:
+      // DO NOTHING
+      return;
 
-  case ANEURALNETWORKS_FUSED_RELU:
+    case ANEURALNETWORKS_FUSED_RELU:
     {
-      const arm_compute::ActivationLayerInfo relu_info(arm_compute::ActivationLayerInfo::ActivationFunction::RELU);
+      const arm_compute::ActivationLayerInfo relu_info(
+          arm_compute::ActivationLayerInfo::ActivationFunction::RELU);
 
       // Do in-place update
       relu_f->configure(out.ptr(), nullptr, relu_info);
     }
     break;
 
-  case ANEURALNETWORKS_FUSED_RELU1:
+    case ANEURALNETWORKS_FUSED_RELU1:
     {
-      const arm_compute::ActivationLayerInfo relu_info(arm_compute::ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 1.f);
+      const arm_compute::ActivationLayerInfo relu_info(
+          arm_compute::ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 1.f);
 
       // Do in-place update
       relu_f->configure(out.ptr(), nullptr, relu_info);
     }
     break;
 
-  case ANEURALNETWORKS_FUSED_RELU6:
+    case ANEURALNETWORKS_FUSED_RELU6:
     {
-      const arm_compute::ActivationLayerInfo relu_info(arm_compute::ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 6.f);
+      const arm_compute::ActivationLayerInfo relu_info(
+          arm_compute::ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 6.f);
 
       // Do in-place update
       relu_f->configure(out.ptr(), nullptr, relu_info);
     }
     break;
 
-  default:
-    assert("Undefined activation type." && 0);
-    break;
+    default:
+      assert("Undefined activation type." && 0);
+      break;
   }
 
   fns.emplace_back(relu_f);
index d04aef5..621f7fb 100644 (file)
@@ -27,7 +27,7 @@ namespace feature
 
 // TODO Extract this function as utility function
 // NOTE It is not a good design to access nnfw::rt::Shape nnfw_support_nnapi lib
-nnfw::util::feature::Shape asFeatureShape(const nnfw::rt::Shapeshape)
+nnfw::util::feature::Shape asFeatureShape(const nnfw::rt::Shape &shape)
 {
   // NNAPI assumes the following ordering:
   //
index 751d2c6..065c08d 100644 (file)
@@ -38,7 +38,7 @@ namespace feature
 
 // TODO Extract this function as utility function
 // NOTE It is not a good design to access nnfw::rt::Shape nnfw_support_nnapi lib
-nnfw::util::feature::Shape asFeatureShape(const nnfw::rt::Shapeshape);
+nnfw::util::feature::Shape asFeatureShape(const nnfw::rt::Shape &shape);
 
 } // namespace feature
 } // namespace nnapi
@@ -58,9 +58,9 @@ namespace acl
 namespace feature
 {
 
-template<typename T> class Reader;
+template <typename T> class Reader;
 
-template<> class Reader<float> final : public nnfw::util::feature::Reader<float>
+template <> class Reader<float> final : public nnfw::util::feature::Reader<float>
 {
 public:
   Reader(arm_compute::ITensor *tensor) : _tensor{tensor}
@@ -78,7 +78,8 @@ private:
   float *ptr_to_element(uint32_t ch, uint32_t row, uint32_t col) const
   {
     // ARM Compute uses CHW ordering
-    return reinterpret_cast<float *>(_tensor->ptr_to_element(arm_compute::Coordinates{col, row, ch}));
+    return reinterpret_cast<float *>(
+        _tensor->ptr_to_element(arm_compute::Coordinates{col, row, ch}));
   }
 
 private:
index 7e5df53..bf4f08b 100644 (file)
 
 #include "util.h"
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
-namespace util {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
+namespace util
+{
 
-void initData(floatdata, int num, float value)
+void initData(float *data, int num, float value)
 {
-  for (int i = 0; i < num; i++) {
+  for (int i = 0; i < num; i++)
+  {
     *(data + i) = value;
   }
 }
 
-void initData_Increasing(floatdata, int num, float value)
+void initData_Increasing(float *data, int num, float value)
 {
-  for (int i = 0; i < num; i++) {
+  for (int i = 0; i < num; i++)
+  {
     *(data + i) = value;
     value++;
   }
@@ -41,34 +47,38 @@ void initData_Increasing(float* data, int num, float value)
 // compareData
 // return true if result == expected with the shape info,
 // otherwise false
-bool compareData(const float* result, const float* expected, const nnfw::rt::Shape& shape)
+bool compareData(const float *result, const float *expected, const nnfw::rt::Shape &shape)
 {
   if (shape.dimensions.size() == 4)
   {
-  // TODO fix indentation
-  uint32_t height = nnfw::rt::getSizeOfDimension(shape, 1);
-  uint32_t width  = nnfw::rt::getSizeOfDimension(shape, 2);
-  uint32_t numitems = height * width;
-  for (int item = 0; item < numitems; item++) {
-    if (!::nnfw::util::fp32::epsilon_equal(*(result + item), *(expected + item), 1)) {
-      LOG(ERROR) << "compareData failed: result " << *(result + item)
-                 << ", expected " << *(expected + item)
-                 << ", diff " << ::nnfw::util::fp32::relative_diff(*(result + item), *(expected + item))
-                 << std::endl;
-      return false;
+    // TODO fix indentation
+    uint32_t height = nnfw::rt::getSizeOfDimension(shape, 1);
+    uint32_t width = nnfw::rt::getSizeOfDimension(shape, 2);
+    uint32_t numitems = height * width;
+    for (int item = 0; item < numitems; item++)
+    {
+      if (!::nnfw::util::fp32::epsilon_equal(*(result + item), *(expected + item), 1))
+      {
+        LOG(ERROR) << "compareData failed: result " << *(result + item) << ", expected "
+                   << *(expected + item) << ", diff "
+                   << ::nnfw::util::fp32::relative_diff(*(result + item), *(expected + item))
+                   << std::endl;
+        return false;
+      }
     }
   }
-  }
   else if (shape.dimensions.size() == 2)
   {
     uint32_t height = nnfw::rt::getSizeOfDimension(shape, 0);
-    uint32_t width  = nnfw::rt::getSizeOfDimension(shape, 1);
+    uint32_t width = nnfw::rt::getSizeOfDimension(shape, 1);
     uint32_t numitems = height * width;
-    for (int item = 0; item < numitems; item++) {
-      if (!::nnfw::util::fp32::epsilon_equal(*(result + item), *(expected + item), 1)) {
-        LOG(ERROR) << "compareData failed: result " << *(result + item)
-                   << ", expected " << *(expected + item)
-                   << ", diff " << ::nnfw::util::fp32::relative_diff(*(result + item), *(expected + item))
+    for (int item = 0; item < numitems; item++)
+    {
+      if (!::nnfw::util::fp32::epsilon_equal(*(result + item), *(expected + item), 1))
+      {
+        LOG(ERROR) << "compareData failed: result " << *(result + item) << ", expected "
+                   << *(expected + item) << ", diff "
+                   << ::nnfw::util::fp32::relative_diff(*(result + item), *(expected + item))
                    << std::endl;
         return false;
       }
@@ -82,17 +92,21 @@ bool compareData(const float* result, const float* expected, const nnfw::rt::Sha
   return true;
 }
 
-void NCHW2NHWC(const float* nchw, float* nhwc, const nnfw::rt::Shape& shape)
+void NCHW2NHWC(const float *nchw, float *nhwc, const nnfw::rt::Shape &shape)
 {
   uint32_t N = nnfw::rt::getSizeOfDimension(shape, 0);
   uint32_t H = nnfw::rt::getSizeOfDimension(shape, 1);
   uint32_t W = nnfw::rt::getSizeOfDimension(shape, 2);
   uint32_t C = nnfw::rt::getSizeOfDimension(shape, 3);
 
-  for (uint32_t n = 0; n < N; n++) {
-    for (uint32_t c = 0; c < C; c++) {
-      for (uint32_t h = 0; h < H; h++) {
-        for (uint32_t w = 0; w < W; w++) {
+  for (uint32_t n = 0; n < N; n++)
+  {
+    for (uint32_t c = 0; c < C; c++)
+    {
+      for (uint32_t h = 0; h < H; h++)
+      {
+        for (uint32_t w = 0; w < W; w++)
+        {
           uint32_t soffset = w + (h * W) + (c * W * H) + (n * W * H * C);
           uint32_t doffset = c + (w * C) + (h * C * W) + (n * C * W * H);
           *(nhwc + doffset) = *(nchw + soffset);
index 48ed027..976c6eb 100644 (file)
 #include <cassert>
 #include <functional>
 
-namespace nnfw {
-namespace kernel {
-namespace acl {
-namespace util {
+namespace nnfw
+{
+namespace kernel
+{
+namespace acl
+{
+namespace util
+{
 
 // TODO: make a separate module.
-class TensorWrapper {
+class TensorWrapper
+{
 public:
-  TensorWrapper(std::vector<uint32_t> dims,
-      OperandType type = OperandType::FLOAT32,
-      float scale = 1.0,
-      int32_t offset = 0)
-  :_shape{type, dims, scale, offset}
+  TensorWrapper(std::vector<uint32_t> dims, OperandType type = OperandType::FLOAT32,
+                float scale = 1.0, int32_t offset = 0)
+      : _shape{type, dims, scale, offset}
   {
 
     // currently, we support only FLOAT32 for now.
-    assert( type == OperandType::FLOAT32);
+    assert(type == OperandType::FLOAT32);
 
     uint32_t size_bytes = sizeof(float);
 
     _num_elems = 1;
-    for( auto& d: dims ) {
+    for (auto &d : dims)
+    {
       _num_elems *= d;
     }
 
     _data = new uint8_t[_num_elems * size_bytes];
   }
 
-  ~TensorWrapper() {
-    delete [] _data;
-  }
+  ~TensorWrapper() { delete[] _data; }
 
-  const nnfw::rt::Shape shape() const {
-    return _shape;
-  }
+  const nnfw::rt::Shape shape() const { return _shape; }
 
   uint32_t num_elems() const { return _num_elems; }
 
-  template<class T>
-  T at(const uint32_t& idx) const {
-    return reinterpret_cast<T*>(_data)[idx];
-  }
+  template <class T> T at(const uint32_t &idx) const { return reinterpret_cast<T *>(_data)[idx]; }
 
-  template<class T>
-  T& at(const uint32_t& idx) {
-    return reinterpret_cast<T*>(_data)[idx];
-  }
+  template <class T> T &at(const uint32_t &idx) { return reinterpret_cast<T *>(_data)[idx]; }
 
-  template<class T>
-  T* ptr() { return reinterpret_cast<T*>(_data); }
+  template <class T> T *ptr() { return reinterpret_cast<T *>(_data); }
 
-  void initValue(float f) {
-    for( uint32_t i = 0; i < _num_elems; ++i ) {
+  void initValue(float f)
+  {
+    for (uint32_t i = 0; i < _num_elems; ++i)
+    {
       at<float>(i) = f;
     }
   }
 
   typedef std::function<float(uint32_t n, uint32_t c, uint32_t h, uint32_t w)> funcInit4;
-  void initValue(funcInit4 f) {
+  void initValue(funcInit4 f)
+  {
     assert(_shape.dimensions.size() == 4);
 
     int N = _shape.dimensions[0];
@@ -88,12 +84,16 @@ public:
     int W = _shape.dimensions[2];
     int C = _shape.dimensions[3];
 
-    for(int n = 0; n < N; ++n) {
-      for(int h = 0; h < H; ++h) {
-        for(int w = 0; w < W; ++w) {
-          for(int c = 0; c < C; ++c) {
-            uint32_t offset = n*H*W*C + h*W*C + w*C + c;
-            at<float>(offset) = f(n,c,h,w);
+    for (int n = 0; n < N; ++n)
+    {
+      for (int h = 0; h < H; ++h)
+      {
+        for (int w = 0; w < W; ++w)
+        {
+          for (int c = 0; c < C; ++c)
+          {
+            uint32_t offset = n * H * W * C + h * W * C + w * C + c;
+            at<float>(offset) = f(n, c, h, w);
           }
         }
       }
@@ -101,58 +101,70 @@ public:
   }
 
   typedef std::function<float(uint32_t c, uint32_t h, uint32_t w)> funcInit3;
-  void initValue(funcInit3 f) {
+  void initValue(funcInit3 f)
+  {
     assert(_shape.dimensions.size() == 3);
 
     int C = _shape.dimensions[0];
     int H = _shape.dimensions[1];
     int W = _shape.dimensions[2];
 
-    for(int h = 0; h < H; ++h) {
-      for(int w = 0; w < W; ++w) {
-        for(int c = 0; c < C; ++c) {
-          uint32_t offset = h*W*C + w*C + c;
-          at<float>(offset) = f(c,h,w);
+    for (int h = 0; h < H; ++h)
+    {
+      for (int w = 0; w < W; ++w)
+      {
+        for (int c = 0; c < C; ++c)
+        {
+          uint32_t offset = h * W * C + w * C + c;
+          at<float>(offset) = f(c, h, w);
         }
       }
     }
   }
 
   typedef std::function<float(uint32_t h, uint32_t w)> funcInit2;
-  void initValue(funcInit2 f) {
+  void initValue(funcInit2 f)
+  {
     assert(_shape.dimensions.size() == 2);
 
     int H = _shape.dimensions[0];
     int W = _shape.dimensions[1];
 
-    for(int h = 0; h < H; ++h) {
-      for(int w = 0; w < W; ++w) {
-        uint32_t offset = h*W + w;
-        at<float>(offset) = f(h,w);
+    for (int h = 0; h < H; ++h)
+    {
+      for (int w = 0; w < W; ++w)
+      {
+        uint32_t offset = h * W + w;
+        at<float>(offset) = f(h, w);
       }
     }
   }
 
   typedef std::function<float(uint32_t w)> funcInit1;
-  void initValue(funcInit1 f) {
+  void initValue(funcInit1 f)
+  {
     assert(_shape.dimensions.size() == 1);
 
     int W = _shape.dimensions[0];
 
-    for(int w = 0; w < W; ++w) {
+    for (int w = 0; w < W; ++w)
+    {
       uint32_t offset = w;
       at<float>(offset) = f(w);
     }
   }
 
-  void initValue(std::vector<float> v) {
+  void initValue(std::vector<float> v)
+  {
     assert(v.size() == _num_elems);
-    for( uint32_t i = 0; i < _num_elems; ++i ) {
+    for (uint32_t i = 0; i < _num_elems; ++i)
+    {
       at<float>(i) = v[i];
     }
   }
 
-  bool operator==(const TensorWrapper &t) const {
+  bool operator==(const TensorWrapper &t) const
+  {
     // compare the shape
     assert(num_elems() == t.num_elems());
     assert(_shape.type == t.shape().type);
@@ -163,9 +175,12 @@ public:
     // currently, we support only FLOAT32.
     assert(_shape.type == OperandType::FLOAT32);
 
-    for( uint32_t i = 0; i < _num_elems; ++i ) {
-      if( std::fabs(static_cast<float>(at<float>(i) - t.at<float>(i))) > 0.001f ) {
-        std::cout << "Comparing [" << i << "] " << at<float>(i) << "," << t.at<float>(i) << std::endl;
+    for (uint32_t i = 0; i < _num_elems; ++i)
+    {
+      if (std::fabs(static_cast<float>(at<float>(i) - t.at<float>(i))) > 0.001f)
+      {
+        std::cout << "Comparing [" << i << "] " << at<float>(i) << "," << t.at<float>(i)
+                  << std::endl;
         return false;
       }
     }
@@ -175,15 +190,15 @@ public:
 
 private:
   nnfw::rt::Shape _shape;
-  uint32_t           _num_elems;
-  uint8_t*           _data;
+  uint32_t _num_elems;
+  uint8_t *_data;
 };
 
-void initData(floatdata, int num, float value);
-bool compareData(const float* result, const float* expected, const nnfw::rt::Shape& shape);
-void initData_Increasing(floatdata, int num, float value);
+void initData(float *data, int num, float value);
+bool compareData(const float *result, const float *expected, const nnfw::rt::Shape &shape);
+void initData_Increasing(float *data, int num, float value);
 
-void NCHW2NHWC(const float* nchw, float* nhwc, const nnfw::rt::Shape& shape);
+void NCHW2NHWC(const float *nchw, float *nhwc, const nnfw::rt::Shape &shape);
 
 } // namespace util
 } // namespace acl
index d5e788c..871d014 100644 (file)
@@ -28,11 +28,12 @@ class DiffSummary : public TfLiteTensorComparator::Observer
 {
 public:
   DiffSummary()
-      : max_abs_diff_index(0), max_abs_diff_value{0.0f},
-        max_rel_diff_index(0), max_rel_diff_value{0.0f}
+      : max_abs_diff_index(0), max_abs_diff_value{0.0f}, max_rel_diff_index(0),
+        max_rel_diff_value{0.0f}
   {
     // DO NOTHING
   }
+
 public:
   void notify(const nnfw::util::tensor::Index &index, float expected, float obtained) override;
 
@@ -81,33 +82,32 @@ TfLiteTensorComparator::compare(const nnfw::support::tflite::TensorView<float> &
   assert(expected.shape() == obtained.shape());
 
   nnfw::util::tensor::zip(expected.shape(), expected, obtained) <<
-    [&] (const nnfw::util::tensor::Index &index, float expected_value, float obtained_value)
-  {
-    const auto relative_diff = nnfw::util::fp32::relative_diff(expected_value, obtained_value);
+      [&](const nnfw::util::tensor::Index &index, float expected_value, float obtained_value) {
+        const auto relative_diff = nnfw::util::fp32::relative_diff(expected_value, obtained_value);
 
-    if (!_compare_fn(expected_value, obtained_value))
-    {
-      TfLiteTensorDiff diff(index);
+        if (!_compare_fn(expected_value, obtained_value))
+        {
+          TfLiteTensorDiff diff(index);
 
-      diff.expected = expected_value;
-      diff.obtained = obtained_value;
+          diff.expected = expected_value;
+          diff.obtained = obtained_value;
 
-      res.emplace_back(diff);
-    }
+          res.emplace_back(diff);
+        }
 
-    // Update max_diff_index, if necessary
-    if (observer != nullptr)
-    {
-      observer->notify(index, expected_value, obtained_value);
-    }
-  };
+        // Update max_diff_index, if necessary
+        if (observer != nullptr)
+        {
+          observer->notify(index, expected_value, obtained_value);
+        }
+      };
 
   return res;
 }
 
-bool TfLiteInterpMatchApp::compareSingleTensorView(const nnfw::support::tflite::TensorView<float> &expected,
-                                                   const nnfw::support::tflite::TensorView<float> &obtained,
-                                                   int id) const
+bool TfLiteInterpMatchApp::compareSingleTensorView(
+    const nnfw::support::tflite::TensorView<float> &expected,
+    const nnfw::support::tflite::TensorView<float> &obtained, int id) const
 {
   DiffSummary summary;
 
@@ -126,7 +126,8 @@ bool TfLiteInterpMatchApp::compareSingleTensorView(const nnfw::support::tflite::
   // Print out max_diff
   if (summary.max_abs_diff_value > 0)
   {
-    std::cout << "    Max absolute diff at [" << nnfw::util::tensor::IndexFormatter(summary.max_abs_diff_index) << "]" << std::endl;
+    std::cout << "    Max absolute diff at ["
+              << nnfw::util::tensor::IndexFormatter(summary.max_abs_diff_index) << "]" << std::endl;
     std::cout << "       expected: " << summary.max_abs_diff_expected << std::endl;
     std::cout << "       obtained: " << summary.max_abs_diff_obtained << std::endl;
     std::cout << "       absolute diff: " << summary.max_abs_diff_value << std::endl;
@@ -136,7 +137,8 @@ bool TfLiteInterpMatchApp::compareSingleTensorView(const nnfw::support::tflite::
   {
     const auto tolerance_level = summary.max_rel_diff_value / FLT_EPSILON;
 
-    std::cout << "    Max relative diff at [" << nnfw::util::tensor::IndexFormatter(summary.max_rel_diff_index) << "]" << std::endl;
+    std::cout << "    Max relative diff at ["
+              << nnfw::util::tensor::IndexFormatter(summary.max_rel_diff_index) << "]" << std::endl;
     std::cout << "       expected: " << summary.max_rel_diff_expected << std::endl;
     std::cout << "       obtained: " << summary.max_rel_diff_obtained << std::endl;
     std::cout << "       relative diff: " << summary.max_rel_diff_value << std::endl;
@@ -154,7 +156,8 @@ bool TfLiteInterpMatchApp::compareSingleTensorView(const nnfw::support::tflite::
         const auto relative_diff = nnfw::util::fp32::relative_diff(diff.expected, diff.obtained);
         const auto tolerance_level = relative_diff / FLT_EPSILON;
 
-        std::cout << "    Diff at [" << nnfw::util::tensor::IndexFormatter(diff.index) << "]" << std::endl;
+        std::cout << "    Diff at [" << nnfw::util::tensor::IndexFormatter(diff.index) << "]"
+                  << std::endl;
         std::cout << "      expected: " << diff.expected << std::endl;
         std::cout << "      obtained: " << diff.obtained << std::endl;
         std::cout << "      absolute diff: " << absolute_diff << std::endl;
@@ -206,8 +209,7 @@ int RandomTestRunner::run(const nnfw::support::tflite::interp::Builder &builder)
   assert(pure->inputs() == nnapi->inputs());
 
   // Fill IFM with random numbers
-  auto ifm_gen = [this] (const nnfw::util::tensor::Shape &, const nnfw::util::tensor::Index &)
-  {
+  auto ifm_gen = [this](const nnfw::util::tensor::Shape &, const nnfw::util::tensor::Index &) {
     // TODO Allow users to set min/max and distribution
     std::normal_distribution<float> dist(0.0f, 2.0f);
     return dist(_rand);
@@ -224,8 +226,7 @@ int RandomTestRunner::run(const nnfw::support::tflite::interp::Builder &builder)
 
     assert(pure_view.shape() == data.shape());
 
-    nnfw::util::tensor::iterate(pure_view.shape()) << [&] (const nnfw::util::tensor::Index &ind)
-    {
+    nnfw::util::tensor::iterate(pure_view.shape()) << [&](const nnfw::util::tensor::Index &ind) {
       const auto value = data.at(ind);
 
       pure_view.at(ind) = value;
@@ -244,8 +245,7 @@ int RandomTestRunner::run(const nnfw::support::tflite::interp::Builder &builder)
 
   const auto tolerance = _param.tolerance;
 
-  auto equals = [tolerance] (float lhs, float rhs)
-  {
+  auto equals = [tolerance](float lhs, float rhs) {
     // NOTE Hybrid approach
     // TODO Allow users to set tolerance for absolute_epsilon_equal
     if (nnfw::util::fp32::absolute_epsilon_equal(lhs, rhs))
index 9e164ac..2618d1c 100644 (file)
@@ -25,7 +25,8 @@ namespace support
 namespace tflite
 {
 
-TensorView<float>::TensorView(const nnfw::util::tensor::Shape &shape, float *base) : _shape{shape}, _base{base}
+TensorView<float>::TensorView(const nnfw::util::tensor::Shape &shape, float *base)
+    : _shape{shape}, _base{base}
 {
   // Set 'stride'
   _stride.init(_shape);
index 75993a6..61a2723 100644 (file)
@@ -20,7 +20,7 @@
 
 int main(int argc, char **argv)
 {
-  float value[6] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f };
+  float value[6] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f};
 
   const nnfw::util::tensor::Shape shape{2, 3};
   const nnfw::support::tflite::TensorView<float> view{shape, value};
index a05d78d..01346ee 100644 (file)
@@ -24,8 +24,7 @@ int main(int argc, char **argv)
 
   std::cout << "Iterate over tensor{3, 4, 3, 4}" << std::endl;
 
-  nnfw::util::tensor::iterate(shape) << [] (const nnfw::util::tensor::Index &index)
-  {
+  nnfw::util::tensor::iterate(shape) << [](const nnfw::util::tensor::Index &index) {
     std::cout << "rank: " << index.rank() << std::endl;
 
     for (size_t d = 0; d < index.rank(); ++d)
index c451edd..b07656c 100644 (file)
@@ -54,10 +54,7 @@ Accumulator<T> &operator<<(Accumulator<T> &&acc, Callable cb)
   return acc;
 }
 
-template <typename T> Accumulator<T> measure(T &out)
-{
-  return Accumulator<T>(out);
-}
+template <typename T> Accumulator<T> measure(T &out) { return Accumulator<T>(out); }
 
 } // namespace benchmark
 } // namespace util
index fa9dd51..2445272 100644 (file)
@@ -22,9 +22,8 @@ namespace nnfw
 namespace util
 {
 
-int get_env_int(const char* name);
-bool get_env_bool(const char* name);
-
+int get_env_int(const char *name);
+bool get_env_bool(const char *name);
 }
 }
 
index e778166..d8ac32a 100644 (file)
@@ -34,7 +34,7 @@ public:
 public:
   Index(int32_t ch, int32_t row, int32_t col) : _ch{ch}, _row{row}, _col{col}
   {
-    // DO NOTHING    
+    // DO NOTHING
   }
 
 public:
index ca217b4..ce66c24 100644 (file)
@@ -30,10 +30,10 @@ namespace util
 namespace feature
 {
 
-template<typename T> class Object final : public Reader<T>
+template <typename T> class Object final : public Reader<T>
 {
 public:
-  using Generator = std::function<T (const Shape &shape, const Index &index)>;
+  using Generator = std::function<T(const Shape &shape, const Index &index)>;
 
 public:
   Object(const Shape &shape, const Generator &fn) : _shape{shape}
index e05c97f..64c926e 100644 (file)
@@ -37,7 +37,6 @@ struct Shape
   {
     // DO NOTHING
   }
-
 };
 
 } // namespace feature
index 91b4c9f..de5c4c1 100644 (file)
@@ -34,8 +34,7 @@ namespace feature
 template <typename T> class TextFormatter
 {
 public:
-  TextFormatter(const Shape &shape, const Reader<T> &data)
-    : _shape(shape), _data(data)
+  TextFormatter(const Shape &shape, const Reader<T> &data) : _shape(shape), _data(data)
   {
     // DO NOTHING
   }
@@ -49,8 +48,7 @@ private:
   const Reader<T> &_data;
 };
 
-template <typename T>
-std::ostream &operator<<(std::ostream &os, const TextFormatter<T> &fmt)
+template <typename T> std::ostream &operator<<(std::ostream &os, const TextFormatter<T> &fmt)
 {
   const auto &shape = fmt.shape();
 
index ceed7a0..d6fca9a 100644 (file)
@@ -29,7 +29,7 @@ namespace util
 namespace kernel
 {
 
-template<typename T> class RandomObject final : public Reader<T>
+template <typename T> class RandomObject final : public Reader<T>
 {
 public:
   RandomObject(const Shape &shape) : _shape{shape}
index e74b092..9d17b14 100644 (file)
@@ -33,10 +33,7 @@ namespace tensor
 struct Index
 {
 public:
-  Index(size_t rank)
-  {
-    _offsets.resize(rank);
-  }
+  Index(size_t rank) { _offsets.resize(rank); }
 
 public:
   Index(std::initializer_list<int32_t> offsets) : _offsets{offsets}
index 839bce2..7afd089 100644 (file)
@@ -32,10 +32,10 @@ namespace util
 namespace tensor
 {
 
-template<typename T> class Object final : public Reader<T>
+template <typename T> class Object final : public Reader<T>
 {
 public:
-  using Generator = std::function<T (const Shape &shape, const Index &index)>;
+  using Generator = std::function<T(const Shape &shape, const Index &index)>;
 
 public:
   Object(const Shape &shape, const Generator &fn) : _shape{shape}
@@ -47,20 +47,15 @@ public:
     _values.resize(_shape.dim(0) * _stride.at(0));
 
     // Set 'value'
-    iterate(_shape) << [this, &fn] (const Index &index)
-    {
-      _values.at(_stride.offset(index)) = fn(_shape, index);
-    };
+    iterate(_shape) <<
+        [this, &fn](const Index &index) { _values.at(_stride.offset(index)) = fn(_shape, index); };
   }
 
 public:
   const Shape &shape(void) const { return _shape; }
 
 public:
-  T at(const Index &index) const override
-  {
-    return _values.at(_stride.offset(index));
-  }
+  T at(const Index &index) const override { return _values.at(_stride.offset(index)); }
 
 private:
   Shape _shape;
index d4edeaa..c9d8c46 100644 (file)
@@ -32,10 +32,7 @@ namespace tensor
 class Shape
 {
 public:
-  Shape(size_t rank)
-  {
-    _dimensions.resize(rank);
-  }
+  Shape(size_t rank) { _dimensions.resize(rank); }
 
 public:
   Shape(const std::initializer_list<int32_t> &dimensions) : _dimensions{dimensions}
index fc2d94e..5d40736 100644 (file)
@@ -32,7 +32,7 @@ template <typename T> class Zipper
 {
 public:
   Zipper(const Shape &shape, const Reader<T> &lhs, const Reader<T> &rhs)
-    : _shape{shape}, _lhs{lhs}, _rhs{rhs}
+      : _shape{shape}, _lhs{lhs}, _rhs{rhs}
   {
     // DO NOTHING
   }
@@ -40,10 +40,8 @@ public:
 public:
   template <typename Callable> void zip(Callable cb) const
   {
-    iterate(_shape) << [this, &cb] (const Index &index)
-    {
-      cb(index, _lhs.at(index), _rhs.at(index));
-    };
+    iterate(_shape) <<
+        [this, &cb](const Index &index) { cb(index, _lhs.at(index), _rhs.at(index)); };
   }
 
 private:
@@ -52,15 +50,14 @@ private:
   const Reader<T> &_rhs;
 };
 
-template<typename T, typename Callable>
+template <typename T, typename Callable>
 const Zipper<T> &operator<<(const Zipper<T> &zipper, Callable cb)
 {
   zipper.zip(cb);
   return zipper;
 }
 
-template<typename T>
-Zipper<T> zip(const Shape &shape, const Reader<T> &lhs, const Reader<T> &rhs)
+template <typename T> Zipper<T> zip(const Shape &shape, const Reader<T> &lhs, const Reader<T> &rhs)
 {
   return Zipper<T>{shape, lhs, rhs};
 }
index 49a58a4..02f7825 100644 (file)
@@ -19,8 +19,7 @@
 
 #include <vector>
 
-template <typename T> 
-bool operator==(const std::vector<T> &lhs, const std::vector<T> &rhs)
+template <typename T> bool operator==(const std::vector<T> &lhs, const std::vector<T> &rhs)
 {
   if (lhs.size() != rhs.size())
   {
index b1bc521..407c06d 100644 (file)
@@ -29,10 +29,10 @@ namespace util
 namespace vector
 {
 
-template<typename T> class Object final : public Reader<T>
+template <typename T> class Object final : public Reader<T>
 {
 public:
-  using Generator = std::function<T (int32_t size, int32_t offset)>;
+  using Generator = std::function<T(int32_t size, int32_t offset)>;
 
 public:
   Object(int32_t size, const Generator &gen) : _size{size}
index dca6c5c..dd57e0c 100644 (file)
@@ -25,7 +25,7 @@ namespace nnfw
 namespace util
 {
 
-int get_env_int(const charname)
+int get_env_int(const char *name)
 {
   const char *value = std::getenv(name);
   if (value != nullptr)
@@ -33,7 +33,7 @@ int get_env_int(const char* name)
   return 0;
 }
 
-bool get_env_bool(const charname)
+bool get_env_bool(const char *name)
 {
   const char *value = std::getenv(name);
   if (value != nullptr)
index d177d13..450b6f8 100644 (file)
@@ -32,7 +32,7 @@ bool operator==(const Shape &lhs, const Shape &rhs)
 
   for (size_t axis = 0; axis < lhs.rank(); ++axis)
   {
-    if(lhs.dim(axis) != rhs.dim(axis))
+    if (lhs.dim(axis) != rhs.dim(axis))
     {
       return false;
     }