VERBOSE(NNAPI::Execution) << "setInput: Shape mismatch" << std::endl;
return ANEURALNETWORKS_BAD_DATA;
}
-
- // TODO Handle specifed dimension on execution
- if (execution->haveUnspecifiedDims(operand_index))
- {
- VERBOSE(NNAPI::Execution) << "setInput: Cannot handle specified dimension on execution yet"
- << std::endl;
- return ANEURALNETWORKS_BAD_STATE;
- }
}
else
{
VERBOSE(NNAPI::Execution) << "setOutput: Shape mismatch" << std::endl;
return ANEURALNETWORKS_BAD_DATA;
}
-
- // TODO Handle specifed dimension on execution
- if (execution->haveUnspecifiedDims(operand_index))
- {
- VERBOSE(NNAPI::Execution) << "setOutput: Cannot handle specified dimension on execution yet"
- << std::endl;
- return ANEURALNETWORKS_BAD_STATE;
- }
}
else
{
return ((operand_shape.element_nums() == 0) ? true : false);
}
-bool ANeuralNetworksExecution::setInput(uint32_t index, const ANeuralNetworksOperandType * /*type*/,
+bool ANeuralNetworksExecution::setInput(uint32_t index, const ANeuralNetworksOperandType *type,
const void *buffer, size_t length) noexcept
{
try
{
neurun::model::operand::IO::Index input_index{index};
const auto operand_index = getInputOperandIndex(index);
+ bool unspecified = haveUnspecifiedDims(operand_index);
+
const auto type_info = _executor->model().operands.at(operand_index).typeInfo();
- const auto shape = _executor->model().operands.at(operand_index).shape();
+ const auto shape = (unspecified ? neurun::util::getShape(type)
+ : _executor->model().operands.at(operand_index).shape());
_executor->setInput(input_index, type_info, shape, buffer, length);
}
return true;
}
-bool ANeuralNetworksExecution::setOutput(uint32_t index,
- const ANeuralNetworksOperandType * /*type*/, void *buffer,
- size_t length) noexcept
+bool ANeuralNetworksExecution::setOutput(uint32_t index, const ANeuralNetworksOperandType *type,
+ void *buffer, size_t length) noexcept
{
try
{
neurun::model::operand::IO::Index output_index{index};
const auto operand_index = getOutputOperandIndex(index);
+ bool unspecified = haveUnspecifiedDims(operand_index);
+
const auto type_info = _executor->model().operands.at(operand_index).typeInfo();
- const auto shape = _executor->model().operands.at(operand_index).shape();
+ const auto shape = (unspecified ? neurun::util::getShape(type)
+ : _executor->model().operands.at(operand_index).shape());
_executor->setOutput(output_index, type_info, shape, buffer, length);
}