From 7bb1cbb7de4d509674445998bbd47faab06b1e6c Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=98=A4=ED=98=95=EC=84=9D/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Tue, 1 Oct 2019 12:06:11 +0900 Subject: [PATCH] [pacl] Additional NNAPI implementation for update NNAPI (#7860) - PACL's NNAPI implementation for updated NNAPI generated test - Update skiplist for updated validation check Signed-off-by: Hyeongseok Oh --- runtimes/pure_arm_compute/src/execution.cc | 55 ++++++++++++++++++++++++-- tests/nnapi/nnapi_gtest.skip.armv7l-linux.pacl | 1 + 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/runtimes/pure_arm_compute/src/execution.cc b/runtimes/pure_arm_compute/src/execution.cc index b7eba1c..657d252 100644 --- a/runtimes/pure_arm_compute/src/execution.cc +++ b/runtimes/pure_arm_compute/src/execution.cc @@ -497,10 +497,6 @@ int ANeuralNetworksExecution_startCompute(ANeuralNetworksExecution *execution, return ANEURALNETWORKS_UNEXPECTED_NULL; } - const bool sync = profiling::Context::get().sync(); - const auto &plan = execution->plan(); - const auto &model = plan.model(); - // TODO: Handle event ANeuralNetworksEvent *event_ptr = new ANeuralNetworksEvent{}; if (event_ptr == nullptr) @@ -509,6 +505,20 @@ int ANeuralNetworksExecution_startCompute(ANeuralNetworksExecution *execution, } *event = event_ptr; + return ANeuralNetworksExecution_compute(execution); +} + +int ANeuralNetworksExecution_compute(ANeuralNetworksExecution *execution) +{ + if (execution == nullptr) + { + return ANEURALNETWORKS_UNEXPECTED_NULL; + } + + const bool sync = profiling::Context::get().sync(); + const auto &plan = execution->plan(); + const auto &model = plan.model(); + // Set input(s) for (uint32_t n = 0; n < model.inputs.size(); ++n) { @@ -579,3 +589,40 @@ int ANeuralNetworksExecution_setOutputFromMemory(ANeuralNetworksExecution *execu assert(false); return -1; } + +int ANeuralNetworksExecution_getOutputOperandRank(ANeuralNetworksExecution *execution, + int32_t index, uint32_t *rank) +{ + if ((execution == nullptr) || (rank == nullptr)) + { + return ANEURALNETWORKS_UNEXPECTED_NULL; + } + + const auto &operands = execution->plan().model().operands(); + const auto operand_index = execution->plan().model().outputs.at(index); + const auto &output_shape = operands.at(operand_index).shape(); + + *rank = output_shape.rank(); + + return ANEURALNETWORKS_NO_ERROR; +} + +int ANeuralNetworksExecution_getOutputOperandDimensions(ANeuralNetworksExecution *execution, + int32_t index, uint32_t *dimensions) +{ + if ((execution == nullptr) || (dimensions == nullptr)) + { + return ANEURALNETWORKS_UNEXPECTED_NULL; + } + + const auto &operands = execution->plan().model().operands(); + const auto operand_index = execution->plan().model().outputs.at(index); + const auto &output_shape = operands.at(operand_index).shape(); + + for (uint32_t axis = 0; axis < output_shape.rank(); ++axis) + { + dimensions[axis] = static_cast(output_shape.dim(axis)); + } + + return ANEURALNETWORKS_NO_ERROR; +} diff --git a/tests/nnapi/nnapi_gtest.skip.armv7l-linux.pacl b/tests/nnapi/nnapi_gtest.skip.armv7l-linux.pacl index c6c4f26..6c80803 100644 --- a/tests/nnapi/nnapi_gtest.skip.armv7l-linux.pacl +++ b/tests/nnapi/nnapi_gtest.skip.armv7l-linux.pacl @@ -17,6 +17,7 @@ GeneratedTests.prelu_ex_quant8_1 GeneratedTests.prelu_ex_broadcast_quant8_1 GeneratedTests.svdf* GeneratedTests.transpose_conv_ex_float_4 +GeneratedTests.mobilenet* ValidationTestCompilation.CreateExecution ValidationTestCompilation.Finish ValidationTestCompilation.SetPreference -- 2.7.4