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. | |
Execution (const std::shared_ptr< IExecutors > &executors, const ir::SubgraphIndex &entry_index) | |
Construct a new Execution object for signature. | |
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 | setOutput (const ir::IOIndex &index, void *buffer, size_t length) |
Set output data's information. | |
const ir::OperandInfo & | inputInfo (const ir::IOIndex &index) |
Get the Input Info object. | |
const ir::OperandInfo & | outputInfo (const ir::IOIndex &index) |
Get the Output Info object. | |
const void * | outputBuffer (const ir::IOIndex &index) const |
Get internally allocated output buffer. | |
uint32_t | inputSize () |
Get input size. | |
uint32_t | outputSize () |
Get output size. | |
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. | |
const ExecutionContext & | context () const |
Get context of execution. | |
void | restoreContext (const ExecutionContext &ctx) |
Set context of execution at once. | |
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 30 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.
onert::exec::Execution::Execution | ( | const std::shared_ptr< IExecutors > & | executors, |
const ir::SubgraphIndex & | entry_index | ||
) |
Construct a new Execution object for signature.
[in] | executors | Model executors |
[in] | entry_index | Entry subgraph index |
Definition at line 58 of file Execution.cc.
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 65 of file Execution.cc.
References onert::exec::ExecutionContext::desc, onert::exec::IODescription::inputs, onert::exec::ExecutionContext::shape_updated, and VERBOSE.
|
inline |
Get context of execution.
Definition at line 183 of file Execution.h.
void onert::exec::Execution::execute | ( | ) |
Execution.
Definition at line 100 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 |
float onert::exec::Execution::getLoss | ( | const ir::IOIndex & | ind | ) |
Get loss.
[in] | ind | Output index |
float
Loss value Definition at line 163 of file Execution.cc.
References onert::exec::train::TrainableExecutors::getLoss().
|
inline |
Get the Input Info object.
[in] | index | Input index |
Definition at line 92 of file Execution.h.
References onert::exec::ExecutionContext::desc, and onert::exec::IODescription::inputs.
|
inline |
Get input size.
Definition at line 121 of file Execution.h.
References onert::exec::ExecutionContext::desc, and onert::exec::IODescription::inputs.
bool onert::exec::Execution::isFinished | ( | void | ) | const |
Check execution is finished.
true
if execution is finished, otherwise false
Definition at line 149 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 174 of file Execution.cc.
References onert::exec::train::TrainableExecutors::iterateTrainableTensors().
|
inline |
Get internally allocated output buffer.
[in] | index | Output index |
Definition at line 112 of file Execution.h.
References onert::exec::IExecutor::outputBuffer().
|
inline |
Get the Output Info object.
[in] | index | Output index |
Definition at line 102 of file Execution.h.
References onert::exec::ExecutionContext::desc, and onert::exec::IODescription::outputs.
|
inline |
Get output size.
Definition at line 127 of file Execution.h.
References onert::exec::ExecutionContext::desc, and onert::exec::IODescription::outputs.
|
inline |
Returns primary graph object.
Definition at line 62 of file Execution.h.
References onert::exec::IExecutor::graph().
|
inline |
Set context of execution at once.
[in] | ctx | Execution context |
Definition at line 189 of file Execution.h.
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 82 of file Execution.cc.
References onert::exec::ExecutionContext::desc, and onert::exec::IODescription::inputs.
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 90 of file Execution.cc.
References onert::exec::ExecutionContext::desc, and onert::exec::IODescription::outputs.
void onert::exec::Execution::startExecute | ( | void | ) |
Start asynchronous execution.
Definition at line 134 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 151 of file Execution.cc.
References onert::exec::train::TrainableExecutors::train().
void onert::exec::Execution::waitFinish | ( | void | ) |
Return when execution is finished.
Definition at line 141 of file Execution.cc.
References VERBOSE.