25std::unique_ptr<loco::TensorShape> make_tensor_shape(std::initializer_list<loco::Dimension> dims)
27 auto tensor_shape = std::make_unique<loco::TensorShape>();
29 tensor_shape->
rank(dims.size());
32 for (
auto it = dims.begin(); it != dims.end(); ++it)
34 tensor_shape->
dim(axis++) = *it;
36 assert(axis == dims.size());
49 shape(make_tensor_shape(dims));
56 return take(std::make_unique<GraphOutput>(
size()));
61 std::set<loco::Node *> res;
63 for (uint32_t n = 0; n < g->nodes()->
size(); ++n)
65 res.insert(g->nodes()->at(n));
73 std::map<GraphInputIndex, loco::Node *> table;
75 for (uint32_t n = 0; n < g->nodes()->
size(); ++n)
77 auto node = g->nodes()->at(n);
81 if (service->associated(node))
83 auto input_index = service->index(node);
84 assert(table.find(input_index) == table.end());
85 table[input_index] = node;
90 std::vector<loco::Node *> res;
92 for (uint32_t n = 0; n < g->inputs()->
size(); ++n)
94 auto it = table.find(n);
95 res.emplace_back(it == table.end() ?
nullptr : it->second);
103 std::map<GraphOutputIndex, loco::Node *> table;
105 for (uint32_t n = 0; n < g->nodes()->
size(); ++n)
107 auto node = g->nodes()->at(n);
111 if (service->associated(node))
113 auto output_index = service->index(node);
114 assert(table.find(output_index) == table.end());
115 table[output_index] = node;
120 std::vector<loco::Node *> res;
122 for (uint32_t n = 0; n < g->outputs()->
size(); ++n)
124 auto it = table.find(n);
125 res.emplace_back(it == table.end() ?
nullptr : it->second);
Graph-level Output Metadata.
U * take(std::unique_ptr< U > &&o)
Take the ownership of a given object and returns its raw pointer.
uint32_t size(void) const
Return the number of objects.
const Dimension & dim(uint32_t axis) const
uint32_t rank(void) const
std::set< Node * > all_nodes(Graph *)
Enumerate all the nodes in a given graph.
std::vector< Node * > input_nodes(const Graph *)
std::vector< Node * > output_nodes(Graph *)
std::unique_ptr< Graph > make_graph(void)
GraphInput * create(void)
GraphOutput * create(void)