ONE - On-device Neural Engine
|
Class to define execution instance to collect input/output information for inference and prepare executor run (TODO) More...
#include <Execution.h>
Public Member Functions | |
Execution (const std::shared_ptr< IExecutors > &executors) | |
Construct a new Execution object. | |
const ir::Graph & | primary_subgraph () const |
Returns primary graph object. | |
void | changeInputShape (const ir::IOIndex &index, const ir::Shape &new_shape) |
Change input shape. | |
void | setInput (const ir::IOIndex &index, const void *buffer, size_t length) |
Set input data's information. | |
void | setInput (const ir::IOIndex &index, const ir::Shape &shape, const void *buffer, size_t length) |
Set input data's information, especially to specify unknown dimensions on model build time. | |
void | setOutput (const ir::IOIndex &index, void *buffer, size_t length) |
Set output data's information. | |
void | setOutput (const ir::IOIndex &index, const ir::Shape &shape, void *buffer, size_t length) |
Set output data's information, especially to specify unknown dimensions on model build time. | |
void | setInputLayout (const ir::IOIndex &index, ir::Layout layout) |
Set input data's data format. | |
void | setOutputLayout (const ir::IOIndex &index, ir::Layout layout) |
Set output data's data format. | |
void | setInputType (const ir::IOIndex &index, const ir::TypeInfo &typeInfo) |
Set input type information. | |
void | setOutputType (const ir::IOIndex &index, const ir::TypeInfo &typeInfo) |
Set output type information. | |
void | execute () |
Execution. | |
void | startExecute (void) |
Start asynchronous execution. | |
void | waitFinish (void) |
Return when execution is finished. | |
bool | isFinished (void) const |
Check execution is finished. | |
void | train (uint32_t training_step) |
Train. | |
float | getLoss (const ir::IOIndex &ind) |
Get loss. | |
void | iterateTrainableTensors (const std::function< void(const ir::OperandIndex &, const backend::train::ITrainableTensor *)> &fn) const |
Iterate trainable tensors. | |
ir::Shape | getInputShape (ir::IOIndex ind) const |
ir::Shape | getOutputShape (ir::IOIndex ind) const |
size_t | getInputTotalSize (ir::IOIndex ind) const |
size_t | getOutputTotalSize (ir::IOIndex ind) const |
const void * | getInputBuffer (ir::IOIndex ind) const |
Get pointer of Input Buffer. | |
void * | getOutputBuffer (ir::IOIndex ind) |
Get pointer of Output Buffer. | |
ExecutionOptions & | executionOptions () |
Class to define execution instance to collect input/output information for inference and prepare executor run (TODO)
Definition at line 40 of file Execution.h.
onert::exec::Execution::Execution | ( | const std::shared_ptr< IExecutors > & | executors | ) |
Construct a new Execution object.
[in] | executor | Model executor |
Definition at line 26 of file Execution.cc.
References onert::exec::ExecutionContext::desc, onert::exec::ExecutionOptions::fromGlobalConfig(), onert::exec::IODescription::inputs, onert::exec::ExecutionContext::options, onert::exec::IODescription::outputs, and onert::exec::ExecutionContext::shape_updated.
void onert::exec::Execution::changeInputShape | ( | const ir::IOIndex & | index, |
const ir::Shape & | new_shape | ||
) |
Change input shape.
[in] | index | Input index |
[in] | new_shape | shape to change |
Definition at line 45 of file Execution.cc.
References onert::exec::ExecutionContext::desc, onert::exec::IODescription::inputs, onert::exec::ExecutionContext::shape_updated, and VERBOSE.
Referenced by setInput().
void onert::exec::Execution::execute | ( | ) |
Execution.
Definition at line 118 of file Execution.cc.
References onert::exec::ExecutionContext::desc, onert::exec::IODescription::inputs, onert::exec::IODescription::outputs, onert::exec::ExecutionContext::shape_updated, and VERBOSE.
Referenced by startExecute().
|
inline |
const void * onert::exec::Execution::getInputBuffer | ( | ir::IOIndex | ind | ) | const |
Get pointer of Input Buffer.
[in] | index | Input index |
Definition at line 224 of file Execution.cc.
References onert::exec::ExecutionContext::desc, onert::exec::IODescription::inputs, and onert::util::Index< T, DummyTag >::value().
ir::Shape onert::exec::Execution::getInputShape | ( | ir::IOIndex | ind | ) | const |
Definition at line 197 of file Execution.cc.
References onert::exec::ExecutionContext::desc, onert::exec::IODescription::inputs, and onert::util::Index< T, DummyTag >::value().
size_t onert::exec::Execution::getInputTotalSize | ( | ir::IOIndex | ind | ) | const |
Definition at line 213 of file Execution.cc.
References onert::exec::ExecutionContext::desc, onert::exec::IODescription::inputs, and onert::util::Index< T, DummyTag >::value().
float onert::exec::Execution::getLoss | ( | const ir::IOIndex & | ind | ) |
Get loss.
[in] | ind | Output index |
float
Loss value Definition at line 174 of file Execution.cc.
References onert::exec::train::TrainableExecutors::getLoss().
void * onert::exec::Execution::getOutputBuffer | ( | ir::IOIndex | ind | ) |
Get pointer of Output Buffer.
[in] | index | Output index |
Definition at line 229 of file Execution.cc.
References onert::exec::ExecutionContext::desc, onert::exec::IODescription::outputs, and onert::util::Index< T, DummyTag >::value().
ir::Shape onert::exec::Execution::getOutputShape | ( | ir::IOIndex | ind | ) | const |
Definition at line 208 of file Execution.cc.
References onert::exec::ExecutionContext::desc, onert::exec::IODescription::outputs, and onert::util::Index< T, DummyTag >::value().
size_t onert::exec::Execution::getOutputTotalSize | ( | ir::IOIndex | ind | ) | const |
Definition at line 219 of file Execution.cc.
References onert::exec::ExecutionContext::desc, onert::exec::IODescription::outputs, and onert::util::Index< T, DummyTag >::value().
bool onert::exec::Execution::isFinished | ( | void | ) | const |
Check execution is finished.
true
if execution is finished, otherwise false
Definition at line 160 of file Execution.cc.
void onert::exec::Execution::iterateTrainableTensors | ( | const std::function< void(const ir::OperandIndex &, const backend::train::ITrainableTensor *)> & | fn | ) | const |
Iterate trainable tensors.
[in] | fn | function to be called with OperandIndex and a pointer to ITrainableTensor |
Definition at line 185 of file Execution.cc.
References onert::exec::train::TrainableExecutors::iterateTrainableTensors().
|
inline |
Returns primary graph object.
Definition at line 55 of file Execution.h.
References onert::exec::IExecutor::graph().
void onert::exec::Execution::setInput | ( | const ir::IOIndex & | index, |
const ir::Shape & | shape, | ||
const void * | buffer, | ||
size_t | length | ||
) |
Set input data's information, especially to specify unknown dimensions on model build time.
[in] | index | Input index |
[in] | shape | Input data's shape |
[in] | buffer | Input data's buffer pointer |
[in] | length | Input data's length |
Definition at line 70 of file Execution.cc.
References changeInputShape(), and setInput().
void onert::exec::Execution::setInput | ( | const ir::IOIndex & | index, |
const void * | buffer, | ||
size_t | length | ||
) |
Set input data's information.
[in] | index | Input index |
[in] | buffer | Input data's buffer pointer |
[in] | length | Input data's length |
Definition at line 62 of file Execution.cc.
References onert::exec::ExecutionContext::desc, and onert::exec::IODescription::inputs.
Referenced by setInput().
void onert::exec::Execution::setInputLayout | ( | const ir::IOIndex & | index, |
ir::Layout | layout | ||
) |
Set input data's data format.
[in] | index | Input index |
[in] | layout | Input data's data format |
Definition at line 96 of file Execution.cc.
References onert::exec::ExecutionContext::desc, and onert::exec::IODescription::inputs.
void onert::exec::Execution::setInputType | ( | const ir::IOIndex & | index, |
const ir::TypeInfo & | typeInfo | ||
) |
Set input type information.
[in] | index | Input index |
[in] | typeInfo | Input type information |
Definition at line 106 of file Execution.cc.
References onert::exec::ExecutionContext::desc, onert::exec::IODescription::inputs, and onert::exec::ExecutionContext::shape_updated.
void onert::exec::Execution::setOutput | ( | const ir::IOIndex & | index, |
const ir::Shape & | shape, | ||
void * | buffer, | ||
size_t | length | ||
) |
Set output data's information, especially to specify unknown dimensions on model build time.
[in] | index | Output index |
[in] | shape | Output data's shape |
[in] | buffer | Output data's buffer pointer |
[in] | length | Output data's length |
Definition at line 87 of file Execution.cc.
References onert::exec::ExecutionContext::desc, onert::exec::IODescription::outputs, and setOutput().
void onert::exec::Execution::setOutput | ( | const ir::IOIndex & | index, |
void * | buffer, | ||
size_t | length | ||
) |
Set output data's information.
[in] | index | Output index |
[in] | buffer | Output data's buffer pointer |
[in] | length | Output data's length |
Definition at line 77 of file Execution.cc.
References onert::exec::ExecutionContext::desc, and onert::exec::IODescription::outputs.
Referenced by setOutput().
void onert::exec::Execution::setOutputLayout | ( | const ir::IOIndex & | index, |
ir::Layout | layout | ||
) |
Set output data's data format.
[in] | index | Output index |
[in] | layout | Output data's data format |
Definition at line 101 of file Execution.cc.
References onert::exec::ExecutionContext::desc, and onert::exec::IODescription::outputs.
void onert::exec::Execution::setOutputType | ( | const ir::IOIndex & | index, |
const ir::TypeInfo & | typeInfo | ||
) |
Set output type information.
[in] | index | Output index |
[in] | typeInfo | Output type information |
Definition at line 112 of file Execution.cc.
References onert::exec::ExecutionContext::desc, onert::exec::IODescription::outputs, and onert::exec::ExecutionContext::shape_updated.
void onert::exec::Execution::startExecute | ( | void | ) |
Start asynchronous execution.
Definition at line 145 of file Execution.cc.
void onert::exec::Execution::train | ( | uint32_t | training_step | ) |
Train.
training_step | The number of iterations of the training process. In other words, the number of gradient update. |
Definition at line 162 of file Execution.cc.
References onert::exec::train::TrainableExecutors::train().
void onert::exec::Execution::waitFinish | ( | void | ) |
Return when execution is finished.
Definition at line 152 of file Execution.cc.
References VERBOSE.