void Execution::setInput(const model::IOIndex &index, const void *buffer, size_t length,
model::Layout layout)
{
- const auto input_index = model().inputs.at(index);
- const auto info = model().operands.at(input_index).info();
+ const auto input_index = graph().getInputs().at(index);
+ const auto info = graph().operands().at(input_index).info();
if (length < info.total_size())
{
void Execution::setOutput(const model::IOIndex &index, void *buffer, size_t length,
model::Layout layout)
{
- const auto output_index = model().outputs.at(index);
- const auto info = model().operands.at(output_index).info();
+ const auto output_index = graph().getOutputs().at(index);
+ const auto info = graph().operands().at(output_index).info();
if (length < info.total_size())
{
}
uint32_t cast_index = static_cast<uint32_t>(index);
- if (cast_index >= _execution->model().inputs.size())
+ if (cast_index >= _execution->graph().getInputs().size())
{
// Return invalid index
return neurun::model::OperandIndex{};
}
neurun::model::IOIndex input_index{cast_index};
- const auto operand_index = _execution->model().inputs.at(input_index);
+ const auto operand_index = _execution->graph().getInputs().at(input_index);
return operand_index;
}
}
uint32_t cast_index = static_cast<uint32_t>(index);
- if (cast_index >= _execution->model().outputs.size())
+ if (cast_index >= _execution->graph().getOutputs().size())
{
// Return invalid index
return neurun::model::OperandIndex{};
}
neurun::model::IOIndex output_index{cast_index};
- const auto operand_index = _execution->model().outputs.at(output_index);
+ const auto operand_index = _execution->graph().getOutputs().at(output_index);
return operand_index;
}
{
try
{
- const auto operand_type = _execution->model().operands.at(index).typeInfo();
+ const auto operand_type = _execution->graph().operands().at(index).typeInfo();
const auto typeInfo = NNAPIConvert::getTypeInfo(type);
if (operand_type != typeInfo)
return false;
}
- const auto &operand_shape = _execution->model().operands.at(index).shape();
+ const auto &operand_shape = _execution->graph().operands().at(index).shape();
const auto &shape_from_type = NNAPIConvert::getShape(type);
return operand_shape == shape_from_type;
bool ANeuralNetworksExecution::haveUnspecifiedDims(const neurun::model::OperandIndex index) noexcept
{
- const auto operand_shape = _execution->model().operands.at(index).shape();
+ const auto operand_shape = _execution->graph().operands().at(index).shape();
return operand_shape.num_elements() == 0;
}
{
try
{
- return _execution->model().operands.at(index).operandSize();
+ return _execution->graph().operands().at(index).operandSize();
}
catch (const std::exception &e)
{
neurun::model::IOIndex input_index{index};
const auto operand_index = getInputOperandIndex(index);
- const auto type_info = _execution->model().operands.at(operand_index).typeInfo();
- const auto shape = ((type != nullptr) ? NNAPIConvert::getShape(type)
- : _execution->model().operands.at(operand_index).shape());
+ const auto type_info = _execution->graph().operands().at(operand_index).typeInfo();
+ const auto shape = (type != nullptr) ? NNAPIConvert::getShape(type)
+ : _execution->graph().operands().at(operand_index).shape();
// NOTE The nnapi does not provide setting io_layout and not support changing layout. In other
// words, we can assume that io_layout from nnapi always is the same as layout of the used
neurun::model::IOIndex output_index{index};
const auto operand_index = getOutputOperandIndex(index);
- const auto type_info = _execution->model().operands.at(operand_index).typeInfo();
- const auto shape = ((type != nullptr) ? NNAPIConvert::getShape(type)
- : _execution->model().operands.at(operand_index).shape());
+ const auto type_info = _execution->graph().operands().at(operand_index).typeInfo();
+ const auto shape = (type != nullptr) ? NNAPIConvert::getShape(type)
+ : _execution->graph().operands().at(operand_index).shape();
// NOTE The nnapi does not provide setting io_layout and not support changing layout. In other
// words, we can assume that io_layout from nnapi always is the same as layout of the used
return false;
}
- *rank = _execution->model().operands.at(operand_index).shape().rank();
+ *rank = _execution->graph().operands().at(operand_index).shape().rank();
}
catch (const std::exception &e)
{
return false;
}
- auto shape = _execution->model().operands.at(operand_index).shape();
+ auto shape = _execution->graph().operands().at(operand_index).shape();
for (int i = 0; i < shape.rank(); i++)
{
auto dim = shape.dim(i);