From 3b1b5eacafeda37f949a0efd61dd0c6ab3d1e980 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: Tue, 10 Apr 2018 17:41:16 +0900 Subject: [PATCH] Use N/H/W/C ordering for fromNNShape (#530) NNAPI assumes that N/H/W/C binding for 3D feature map tensor. Signed-off-by: Jonghyun Park --- src/kernel/acl/src/Conv2D_acl.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/kernel/acl/src/Conv2D_acl.cpp b/src/kernel/acl/src/Conv2D_acl.cpp index 44fea16..9c9ca01 100644 --- a/src/kernel/acl/src/Conv2D_acl.cpp +++ b/src/kernel/acl/src/Conv2D_acl.cpp @@ -24,12 +24,17 @@ namespace acl { arm_compute::TensorShape fromNNShape(const android::nn::Shape& shape) { - // NOTE order may be not correct - // TODO check and fix order if incorrect - uint32_t c = android::nn::getSizeOfDimension(shape, 0); + // NNAPI assumes the following ordering: + // + // dim(0) -> N + // dim(1) -> H + // dim(2) -> W + // dim(3) -> C + // + uint32_t c = android::nn::getSizeOfDimension(shape, 3); uint32_t h = android::nn::getSizeOfDimension(shape, 1); uint32_t w = android::nn::getSizeOfDimension(shape, 2); - uint32_t n = android::nn::getSizeOfDimension(shape, 3); + uint32_t n = android::nn::getSizeOfDimension(shape, 0); return arm_compute::TensorShape(w, h, c, n); } -- 2.7.4