From: 박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 Date: Wed, 11 Apr 2018 03:57:16 +0000 (+0900) Subject: Fix convolution kernel test failure (#557) X-Git-Tag: 0.1~340 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c0c423c08e6e266c7f6d038d94b0b6058d1f3384;p=platform%2Fcore%2Fml%2Fnnfw.git Fix convolution kernel test failure (#557) This will fix convolution kernel on acl test Signed-off-by: SaeHie Park --- 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;