Fix convolution kernel test failure (#557)
author박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Wed, 11 Apr 2018 03:57:16 +0000 (12:57 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 11 Apr 2018 03:57:16 +0000 (12:57 +0900)
This will fix convolution kernel on acl test

Signed-off-by: SaeHie Park <saehie.park@samsung.com>
src/kernel/acl/src/Conv2D_acl.cpp
src/kernel/acl/src/Conv2D_acl.test.cpp

index a639e9e..a48f982 100644 (file)
@@ -56,7 +56,6 @@ public:
   CLUniqueTensor(const ::arm_compute::TensorInfo &info)
   {
     _tensor.allocator()->init(info);
-    _tensor.allocator()->allocate();
   }
 
 public:
@@ -72,6 +71,12 @@ public:
   }
 
 public:
+  void allocate()
+  {
+    _tensor.allocator()->allocate();
+  }
+
+public:
   ::arm_compute::CLTensor &ref(void) { return _tensor; }
   ::arm_compute::CLTensor *ptr(void) { return &_tensor; }
 
@@ -105,6 +110,11 @@ bool convFloat32(const float* inputData, const android::nn::Shape& inputShape,
   arm_compute::CLConvolutionLayer conv_f;
   conv_f.configure(input.ptr(), filter.ptr(), bias.ptr(), output.ptr(), conv_info);
 
+  input.allocate();
+  output.allocate();
+  bias.allocate();
+  filter.allocate();
+
   TensorAccess<InputAccessor>(input.ref(), inputData, inputShape);
   TensorAccess<BiasAccessor>(bias.ref(), biasData, biasShape);
   TensorAccess<WeightAccessor>(filter.ref(), filterData, filterShape);
index 65ca493..e2baff9 100644 (file)
@@ -30,7 +30,7 @@ TEST(KernelACL_TC, convFloat32_3x3to1x1)
   float filterData[9];
   const android::nn::Shape filterShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
   float biasData[1] = { 1.0 };
-  const android::nn::Shape biasShape = { OperandType::FLOAT32, {1,1,1,1}, 1.0, 0 };
+  const android::nn::Shape biasShape = { OperandType::FLOAT32, {1}, 1.0, 0 };
   int32_t padding_left = 0;
   int32_t padding_right = 0;
   int32_t padding_top = 0;
@@ -68,7 +68,7 @@ TEST(KernelACL_TC, convFloat32_3x3to3x3)
   float filterData[9];
   const android::nn::Shape filterShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
   float biasData[1] = { 1.0 };
-  const android::nn::Shape biasShape = { OperandType::FLOAT32, {1,1,1,1}, 1.0, 0 };
+  const android::nn::Shape biasShape = { OperandType::FLOAT32, {1}, 1.0, 0 };
   int32_t padding_left = 1;
   int32_t padding_right = 1;
   int32_t padding_top = 1;