summaryrefslogtreecommitdiff
path: root/runtime/onert/frontend/nnapi/execution.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/onert/frontend/nnapi/execution.cc')
-rw-r--r--runtime/onert/frontend/nnapi/execution.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/runtime/onert/frontend/nnapi/execution.cc b/runtime/onert/frontend/nnapi/execution.cc
index ce7da579e..56ca5ef00 100644
--- a/runtime/onert/frontend/nnapi/execution.cc
+++ b/runtime/onert/frontend/nnapi/execution.cc
@@ -94,12 +94,36 @@ int ANeuralNetworksExecution_setInput(ANeuralNetworksExecution *execution, int32
// Omitted optional input
// LSTM operation's some inputs can be optional input
+ // Transpose operation's permutation input can be optional input
if ((buffer == nullptr) && (length == 0))
{
+ uint32_t dims[1] = {0};
+ ANeuralNetworksOperandType compared_shape;
+ compared_shape.dimensionCount = 1;
+ compared_shape.dimensions = dims;
if (execution->hasUnspecifiedDims(operand_index))
{
return ANEURALNETWORKS_NO_ERROR;
}
+ else if (type == nullptr && execution->IsOptionalInput(operand_index))
+ {
+ if (!execution->setOptionalInput(index, type, buffer, length))
+ {
+ VERBOSE(NNAPI::Execution) << "setInput: Fail to set optional input" << std::endl;
+ return ANEURALNETWORKS_BAD_DATA;
+ }
+ return ANEURALNETWORKS_NO_ERROR;
+ }
+ // TODO Changes the condition to check zero sized
+ else if (execution->compareShape(&compared_shape, operand_index))
+ {
+ if (!execution->setInput(index, type, buffer, length))
+ {
+ VERBOSE(NNAPI::Execution) << "setInput: Fail to set input" << std::endl;
+ return ANEURALNETWORKS_BAD_DATA;
+ }
+ return ANEURALNETWORKS_NO_ERROR;
+ }
else
{
VERBOSE(NNAPI::Execution) << "setInput: Cannot handle fully-specified shape on model build "