From 55dd1076baa85d5954b3f3221bc8928079c0831d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=84=9C=EC=83=81=EB=AF=BC/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Thu, 31 May 2018 11:43:37 +0900 Subject: [PATCH] [Pure CL Runtime] Handle shape with rank one on setInput/Output (#1449) This patch revises ANeuralNetworksExecution_setInput/Output to handle the case of rank one. Signed-off-by: Sangmin Seo --- runtimes/pure_arm_compute/src/execution.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/runtimes/pure_arm_compute/src/execution.cc b/runtimes/pure_arm_compute/src/execution.cc index 0214b6a..0884f96 100644 --- a/runtimes/pure_arm_compute/src/execution.cc +++ b/runtimes/pure_arm_compute/src/execution.cc @@ -161,7 +161,13 @@ int ANeuralNetworksExecution_setInput(ANeuralNetworksExecution *execution, int32 // TODO Remove this assumption const auto operand_index = execution->plan().model().inputs.at(index); - if (operands.at(operand_index).shape().rank() == 2) + if (operands.at(operand_index).shape().rank() == 1) + { + const auto len = operands.at(operand_index).shape().dim(0); + + execution->source(index, len, reinterpret_cast(buffer), length); + } + else if (operands.at(operand_index).shape().rank() == 2) { assert(operands.at(operand_index).shape().dim(0) == 1); @@ -194,8 +200,14 @@ int ANeuralNetworksExecution_setOutput(ANeuralNetworksExecution *execution, int3 const auto operand_index = execution->plan().model().outputs.at(index); - if ((operands.at(operand_index).shape().rank() == 2) && - (operands.at(operand_index).shape().dim(0) == 1)) + if (operands.at(operand_index).shape().rank() == 1) + { + const auto len = operands.at(operand_index).shape().dim(0); + + execution->sink(index, len, reinterpret_cast(buffer), length); + } + else if ((operands.at(operand_index).shape().rank() == 2) && + (operands.at(operand_index).shape().dim(0) == 1)) { const auto len = operands.at(operand_index).shape().dim(1); -- 2.7.4