From 5b77100834a2e7f6dbd4627261ea82b15181a1f3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9E=A5=EC=A7=80=EC=84=AD/On-Device=20Lab=28SR=29/Enginee?= =?utf8?q?r/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Tue, 16 Jul 2019 17:10:06 +0900 Subject: [PATCH] Enable acl layout test again (#5650) * Enable acl layout test again This commit enables acl layout test again. Signed-off-by: jiseob.jang * Apply layout for padding data of PadLayer This commit applies layout for padding data of PadLayer. Signed-off-by: jiseob.jang --- runtimes/neurun/backend/acl_cl/KernelGenerator.cc | 27 +++++++++++++++-------- scripts/standalone/test_arm_neurun_mixed.sh | 2 +- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/runtimes/neurun/backend/acl_cl/KernelGenerator.cc b/runtimes/neurun/backend/acl_cl/KernelGenerator.cc index 2834ae5..a3e905e 100644 --- a/runtimes/neurun/backend/acl_cl/KernelGenerator.cc +++ b/runtimes/neurun/backend/acl_cl/KernelGenerator.cc @@ -2207,15 +2207,6 @@ void KernelGenerator::visit(const model::operation::PadNode &node) auto rank = _ctx.at(pad_index).shape().dim(0); auto pad_base = _ctx.at(pad_index).data().base(); - ::arm_compute::PaddingList padding_list; - padding_list.resize(rank); - for (int32_t n = 0; n < rank; ++n) - { - const int32_t *from = reinterpret_cast(pad_base) + (n * 2); - auto axis = acl_common::ToARMComputeAxis(rank, n).value(); - - padding_list[axis] = ::arm_compute::PaddingInfo{from[0], from[1]}; - } auto input_type = _ctx.at(input_index).typeInfo(); auto data_type = acl_common::asDataType(input_type.type()); @@ -2225,6 +2216,24 @@ void KernelGenerator::visit(const model::operation::PadNode &node) auto input = _tensor_builder->at(input_index).get()->handle(); auto output = _tensor_builder->at(output_index).get()->handle(); + ::arm_compute::PaddingList padding_list; + padding_list.resize(rank); + for (int32_t n = 0; n < rank; ++n) + { + + const int32_t *from = reinterpret_cast(pad_base) + (n * 2); + + auto axis = acl_common::ToARMComputeAxis(rank, n).value(); + auto fixed_axis = axis; + if (input->info()->num_dimensions() == 4 && + input->info()->data_layout() == ::arm_compute::DataLayout::NCHW) + { + // CWHN -> WHCN + const int permutation[4] = {2, 0, 1, 3}; + fixed_axis = permutation[fixed_axis]; + } + padding_list[fixed_axis] = ::arm_compute::PaddingInfo{from[0], from[1]}; + } auto fn = nnfw::cpp14::make_unique<::arm_compute::CLPadLayer>(); fn->configure(input, output, padding_list, pixel_value); diff --git a/scripts/standalone/test_arm_neurun_mixed.sh b/scripts/standalone/test_arm_neurun_mixed.sh index 0cdc9a4..7ba9d20 100755 --- a/scripts/standalone/test_arm_neurun_mixed.sh +++ b/scripts/standalone/test_arm_neurun_mixed.sh @@ -24,7 +24,7 @@ unset OP_BACKEND_ALLOPS export OP_BACKEND_Conv2DNode=cpu export OP_BACKEND_MaxPool2DNode=acl_cl export OP_BACKEND_AvgPool2DNode=acl_neon -export ACL_DEFAULT_LAYOUT=NCHW +export ACL_LAYOUT=NCHW # Get the intersect of framework test list files(each backend has a lsit) TESTLIST_PREFIX="tests/scripts/neurun_frameworktest_list.armv7l" -- 2.7.4