From 85c39d8ff36353d196f47440f3f22374fe9d7fbe 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: Mon, 2 Sep 2019 12:45:24 +0900 Subject: [PATCH] Fix null type reference (#7059) Instead of using getOperandSize, use type pointer to find out operand has unspecified shape Signed-off-by: Hyeongseok Oh --- .../neurun/frontend/nnapi/wrapper/ANeuralNetworksExecution.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/runtimes/neurun/frontend/nnapi/wrapper/ANeuralNetworksExecution.cc b/runtimes/neurun/frontend/nnapi/wrapper/ANeuralNetworksExecution.cc index 3ac73a4..ee621e3 100644 --- a/runtimes/neurun/frontend/nnapi/wrapper/ANeuralNetworksExecution.cc +++ b/runtimes/neurun/frontend/nnapi/wrapper/ANeuralNetworksExecution.cc @@ -127,11 +127,10 @@ bool ANeuralNetworksExecution::setInput(uint32_t index, const ANeuralNetworksOpe { neurun::model::IOIndex input_index{index}; const auto operand_index = getInputOperandIndex(index); - bool unspecified = haveUnspecifiedDims(operand_index); const auto type_info = _execution->model().operands.at(operand_index).typeInfo(); - const auto shape = (unspecified ? NNAPIConvert::getShape(type) - : _execution->model().operands.at(operand_index).shape()); + const auto shape = ((type != nullptr) ? NNAPIConvert::getShape(type) + : _execution->model().operands.at(operand_index).shape()); _execution->setInput(input_index, type_info, shape, buffer, length); } @@ -152,11 +151,10 @@ bool ANeuralNetworksExecution::setOutput(uint32_t index, const ANeuralNetworksOp { neurun::model::IOIndex output_index{index}; const auto operand_index = getOutputOperandIndex(index); - bool unspecified = haveUnspecifiedDims(operand_index); const auto type_info = _execution->model().operands.at(operand_index).typeInfo(); - const auto shape = (unspecified ? NNAPIConvert::getShape(type) - : _execution->model().operands.at(operand_index).shape()); + const auto shape = ((type != nullptr) ? NNAPIConvert::getShape(type) + : _execution->model().operands.at(operand_index).shape()); _execution->setOutput(output_index, type_info, shape, buffer, length); } -- 2.7.4