ONE - On-device Neural Engine
|
Session for loco graph inference. More...
#include <Session.h>
Public Member Functions | |
Session ()=delete | |
Session (loco::Graph *g) | |
Make Session for graph with graph outputs themselves. | |
Session (loco::Graph *g, const std::vector< loco::Node * > &custom_outputs) | |
Make Session for graph with selective custom outputs. Only subgraph to calculate given outputs would be executed. | |
template<typename InputIt > | |
Session (loco::Graph *g, InputIt begin, InputIt end) | |
Make Session by range. | |
~Session () | |
Free all node annotations of the graph assigned by this Session. | |
uint32_t | input_size () const |
Get number of graph inputs held by this Session. | |
void | set_input (uint32_t index, std::unique_ptr< NodeData > &&data) |
Set graph input at specific index by NodeData. | |
void | infer () |
Do inference for this session and graph. | |
uint32_t | output_size () const |
Get number of graph outputs held by this Session. | |
const NodeData * | get_output (uint32_t index) |
Get output of graph as NodeData. | |
const loco::Node * | get_output_node (uint32_t index) |
|
delete |
|
inline |
|
inline |
Make Session for graph with selective custom outputs. Only subgraph to calculate given outputs would be executed.
Definition at line 53 of file Session.h.
|
inline |
locomotiv::Session::~Session | ( | ) |
Free all node annotations of the graph assigned by this Session.
Definition at line 30 of file Session.cpp.
References loco::ObjectPool< T >::at(), locomotiv::erase_annot_domain(), loco::Graph::nodes(), and size.
const NodeData * locomotiv::Session::get_output | ( | uint32_t | index | ) |
Get output of graph as NodeData.
Definition at line 85 of file Session.cpp.
References output_size().
Referenced by nnkit::support::moco::tf::OutputTensorContext::getConstFloatTensor().
|
inline |
void locomotiv::Session::infer | ( | ) |
Do inference for this session and graph.
Definition at line 75 of file Session.cpp.
References locomotiv::NodeExecution::get(), loco::postorder_traversal(), and locomotiv::NodeExecution::run().
|
inline |
Get number of graph inputs held by this Session.
Definition at line 70 of file Session.h.
References loco::Graph::inputs(), and loco::ObjectPool< T >::size().
Referenced by set_input().
|
inline |
Get number of graph outputs held by this Session.
Definition at line 90 of file Session.h.
Referenced by get_output().
void locomotiv::Session::set_input | ( | uint32_t | index, |
std::unique_ptr< NodeData > && | data | ||
) |
Set graph input at specific index by NodeData.
runtime_error | In case when another NodeData already annotated for the input, and when given data type or shape are not congruent with loco node information. |
Definition at line 41 of file Session.cpp.
References input_size(), and loco::pull_node().
Referenced by package.infer.session::set_inputs().