From c0c423c08e6e266c7f6d038d94b0b6058d1f3384 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=84=B8=ED=9D=AC/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Principal=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Wed, 11 Apr 2018 12:57:16 +0900 Subject: [PATCH] Fix convolution kernel test failure (#557) This will fix convolution kernel on acl test Signed-off-by: SaeHie Park --- src/kernel/acl/src/Conv2D_acl.cpp | 12 +++++++++++- src/kernel/acl/src/Conv2D_acl.test.cpp | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/kernel/acl/src/Conv2D_acl.cpp b/src/kernel/acl/src/Conv2D_acl.cpp index a639e9e..a48f982 100644 --- a/src/kernel/acl/src/Conv2D_acl.cpp +++ b/src/kernel/acl/src/Conv2D_acl.cpp @@ -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(input.ref(), inputData, inputShape); TensorAccess(bias.ref(), biasData, biasShape); TensorAccess(filter.ref(), filterData, filterShape); diff --git a/src/kernel/acl/src/Conv2D_acl.test.cpp b/src/kernel/acl/src/Conv2D_acl.test.cpp index 65ca493..e2baff9 100644 --- a/src/kernel/acl/src/Conv2D_acl.test.cpp +++ b/src/kernel/acl/src/Conv2D_acl.test.cpp @@ -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; -- 2.7.4