32 for (uint32_t i = 0; i < _graph->
nodes()->
size(); ++i)
34 auto node = _graph->
nodes()->
at(i);
35 erase_user_data(node);
36 erase_annot_data(node);
49 throw std::runtime_error(
"Graph input already has NodeData");
53 if (pull->dtype() != data->dtype())
55 throw std::runtime_error(
"Data type mismatch");
59 auto shape = data->shape();
60 if (pull->rank() != shape->rank())
62 throw std::runtime_error(
"Shape rank mismatch");
64 for (uint32_t i = 0; i < pull->rank(); ++i)
66 if (pull->dim(i).known() && pull->dim(i).value() != shape->dim(i))
68 throw std::runtime_error(
"Shape dimension mismatch");
72 user_data(pull, std::move(data));
79 for (
auto node : schedules)
89 auto output_node = _outputs.at(index);
90 return annot_data(output_node);
NodeContext * nodes(void)
T * at(uint32_t n) const
Access N-th object.
static NodeExecution & get()
void run(loco::Node *node)
Run calculation for one unspecified Node.
const NodeData * get_output(uint32_t index)
Get output of graph as NodeData.
~Session()
Free all node annotations of the graph assigned 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.
uint32_t input_size() const
Get number of graph inputs held by this Session.
std::vector< loco::Node * > postorder_traversal(const std::vector< loco::Node * > &roots)
Generate postorder traversal sequence starting from "roots".
Pull * pull_node(Graph *g, const GraphInputIndex &index)
Find a Pull node with a given input index.
void erase_annot_domain(loco::Node *node)
Erase already annotated node domain.
Read-only no-template wrapper for 'Buffer'. Serves interface for input and output of 'Session'.