From aadb745d12fe96636654ce2c0f873d051028dd01 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Senior=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Wed, 11 Apr 2018 09:56:28 +0900 Subject: [PATCH] Set arm_compute::TensorShape for bias correctly (#549) This commit revises convFloat32 implementation based on ARM Compute to correctly set bias shape. This change fixes clBuffer exception during bias memory allocation. Signed-off-by: Jonghyun Park --- src/kernel/acl/src/Conv2D_acl.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/kernel/acl/src/Conv2D_acl.cpp b/src/kernel/acl/src/Conv2D_acl.cpp index 9c9ca01..704925d 100644 --- a/src/kernel/acl/src/Conv2D_acl.cpp +++ b/src/kernel/acl/src/Conv2D_acl.cpp @@ -3,6 +3,8 @@ #include #include "IO_accessor.h" +#include + namespace android { namespace nn { @@ -22,6 +24,15 @@ namespace nnfw { namespace kernel { namespace acl { +arm_compute::TensorShape fromVectorNNShape(const android::nn::Shape& shape) +{ + assert(shape.dimensions.size() == 1); + + const uint32_t len = android::nn::getSizeOfDimension(shape, 0); + + return arm_compute::TensorShape(len); +} + arm_compute::TensorShape fromNNShape(const android::nn::Shape& shape) { // NNAPI assumes the following ordering: @@ -50,7 +61,7 @@ bool convFloat32(const float* inputData, const android::nn::Shape& inputShape, { arm_compute::TensorShape input_shape = fromNNShape(inputShape); arm_compute::TensorShape filter_shape = fromNNShape(filterShape); - arm_compute::TensorShape bias_shape = fromNNShape(biasShape); + arm_compute::TensorShape bias_shape = fromVectorNNShape(biasShape); arm_compute::TensorShape output_shape = fromNNShape(outputShape); arm_compute::PadStrideInfo conv_info = arm_compute::PadStrideInfo(stride_width, stride_height, padding_left, padding_right, -- 2.7.4