ONE - On-device Neural Engine
|
#include <ModelBuilder.h>
Public Member Functions | |
virtual | ~ModelBuilder ()=default |
int | addOperand (const ANeuralNetworksOperandType &type) |
int | setOperandValue (uint32_t index, const void *buffer, size_t length) |
int | setOperandValueFromMemory (uint32_t index, const Memory *memory, uint32_t offset, size_t length) |
int | addOperation (OperationType type, uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs) |
int | identifyInputsAndOutputs (uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs) |
int | finish () |
bool | isFinished () const |
int | createCompilation (CompilationBuilder **compilation) |
void | publish (Model *model) const |
uint32_t | operandCount () const |
uint32_t | operationCount () const |
uint32_t | inputCount () const |
uint32_t | getInputOperandIndex (uint32_t i) const |
const Operand & | getInputOperand (uint32_t i) const |
uint32_t | outputCount () const |
uint32_t | getOutputOperandIndex (uint32_t i) const |
const Operand & | getOutputOperand (uint32_t i) const |
const Operand & | getOperand (uint32_t index) const |
const Operation & | getOperation (uint32_t index) const |
const MemoryTracker & | getMemories () const |
const std::vector< Operation > & | getOperations () const |
Definition at line 33 of file ModelBuilder.h.
|
virtualdefault |
int ModelBuilder::addOperand | ( | const ANeuralNetworksOperandType & | type | ) |
Definition at line 83 of file ModelBuilder.cpp.
References ANEURALNETWORKS_BAD_DATA, ANEURALNETWORKS_BAD_STATE, ANEURALNETWORKS_NO_ERROR, LOG, MAX_NUMBER_OF_OPERANDS, TEMPORARY_VARIABLE, and validateOperandType().
Referenced by ANeuralNetworksModel_addOperand().
int ModelBuilder::addOperation | ( | OperationType | type, |
uint32_t | inputCount, | ||
const uint32_t * | inputs, | ||
uint32_t | outputCount, | ||
const uint32_t * | outputs | ||
) |
Definition at line 214 of file ModelBuilder.cpp.
References ANEURALNETWORKS_BAD_DATA, ANEURALNETWORKS_BAD_STATE, ANEURALNETWORKS_NO_ERROR, entry(), inputCount(), LOG, MAX_NUMBER_OF_OPERATIONS, operandCount(), operationCount(), outputCount(), validateOperandList(), and validateOperationType().
Referenced by ANeuralNetworksModel_addOperation().
int ModelBuilder::createCompilation | ( | CompilationBuilder ** | compilation | ) |
Definition at line 322 of file ModelBuilder.cpp.
References ANEURALNETWORKS_BAD_STATE, ANEURALNETWORKS_NO_ERROR, ANEURALNETWORKS_OUT_OF_MEMORY, and LOG.
int ModelBuilder::finish | ( | ) |
Definition at line 334 of file ModelBuilder.cpp.
References ANEURALNETWORKS_BAD_DATA, ANEURALNETWORKS_BAD_STATE, ANEURALNETWORKS_NO_ERROR, LOG, publish(), and validateModel().
Referenced by ANeuralNetworksModel_finish().
|
inline |
Definition at line 80 of file ModelBuilder.h.
References getInputOperandIndex().
Referenced by ExecutionBuilder::setInput(), and ExecutionBuilder::setInputFromMemory().
|
inline |
Definition at line 79 of file ModelBuilder.h.
Referenced by getInputOperand().
|
inline |
Definition at line 92 of file ModelBuilder.h.
|
inline |
Definition at line 88 of file ModelBuilder.h.
|
inline |
Definition at line 89 of file ModelBuilder.h.
|
inline |
Definition at line 93 of file ModelBuilder.h.
|
inline |
Definition at line 85 of file ModelBuilder.h.
References getOutputOperandIndex().
Referenced by ExecutionBuilder::setOutput(), and ExecutionBuilder::setOutputFromMemory().
|
inline |
Definition at line 84 of file ModelBuilder.h.
Referenced by getOutputOperand().
int ModelBuilder::identifyInputsAndOutputs | ( | uint32_t | inputCount, |
const uint32_t * | inputs, | ||
uint32_t | outputCount, | ||
const uint32_t * | outputs | ||
) |
Definition at line 262 of file ModelBuilder.cpp.
References ANEURALNETWORKS_BAD_DATA, ANEURALNETWORKS_BAD_STATE, ANEURALNETWORKS_NO_ERROR, inputCount(), Operand::lifetime, LOG, MODEL_INPUT, MODEL_OUTPUT, operandCount(), outputCount(), TEMPORARY_VARIABLE, and validateOperandList().
Referenced by ANeuralNetworksModel_identifyInputsAndOutputs().
|
inline |
Definition at line 78 of file ModelBuilder.h.
Referenced by addOperation(), and identifyInputsAndOutputs().
|
inline |
Definition at line 57 of file ModelBuilder.h.
|
inline |
Definition at line 66 of file ModelBuilder.h.
Referenced by addOperation(), identifyInputsAndOutputs(), setOperandValue(), and setOperandValueFromMemory().
|
inline |
Definition at line 71 of file ModelBuilder.h.
Referenced by addOperation().
|
inline |
Definition at line 83 of file ModelBuilder.h.
Referenced by addOperation(), and identifyInputsAndOutputs().
void ModelBuilder::publish | ( | Model * | model | ) | const |
Definition at line 425 of file ModelBuilder.cpp.
References MemoryTracker::size().
Referenced by finish(), and ExecutionBuilder::startCompute().
int ModelBuilder::setOperandValue | ( | uint32_t | index, |
const void * | buffer, | ||
size_t | length | ||
) |
Definition at line 113 of file ModelBuilder.cpp.
References alignBytesNeeded(), ANEURALNETWORKS_BAD_DATA, ANEURALNETWORKS_BAD_STATE, ANEURALNETWORKS_MAX_SIZE_OF_IMMEDIATELY_COPIED_VALUES, ANEURALNETWORKS_NO_ERROR, CONSTANT_COPY, CONSTANT_REFERENCE, Operand::dimensions, Operand::lifetime, Operand::location, LOG, NO_VALUE, DataLocation::offset, operandCount(), DataLocation::poolIndex, sizeOfData(), Operand::type, and VLOG.
Referenced by ANeuralNetworksModel_setOperandValue().
int ModelBuilder::setOperandValueFromMemory | ( | uint32_t | index, |
const Memory * | memory, | ||
uint32_t | offset, | ||
size_t | length | ||
) |
Definition at line 181 of file ModelBuilder.cpp.
References MemoryTracker::add(), ANEURALNETWORKS_BAD_DATA, ANEURALNETWORKS_BAD_STATE, ANEURALNETWORKS_NO_ERROR, CONSTANT_REFERENCE, Operand::dimensions, Operand::lifetime, Operand::location, LOG, offset(), operandCount(), DataLocation::poolIndex, sizeOfData(), Operand::type, Memory::validateSize(), and VLOG.
Referenced by ANeuralNetworksModel_setOperandValueFromMemory().