Fix null type reference (#7059)
author오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Mon, 2 Sep 2019 03:45:24 +0000 (12:45 +0900)
committer이춘석/On-Device Lab(SR)/Staff Engineer/삼성전자 <chunseok.lee@samsung.com>
Mon, 2 Sep 2019 03:45:24 +0000 (12:45 +0900)
Instead of using getOperandSize, use type pointer to find out operand has unspecified shape

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
runtimes/neurun/frontend/nnapi/wrapper/ANeuralNetworksExecution.cc

index 3ac73a4..ee621e3 100644 (file)
@@ -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);
   }