25std::unique_ptr<loco::TensorShape> make_tensor_shape(std::initializer_list<loco::Dimension> dims)
27 auto tensor_shape = std::make_unique<loco::TensorShape>();
32 for (
auto it =
dims.begin(); it !=
dims.end(); ++it)
34 tensor_shape->
dim(axis++) = *it;
36 assert(axis ==
dims.size());
56 return take(std::make_unique<GraphOutput>(
size()));
61 std::set<loco::Node *>
res;
65 res.insert(g->nodes()->at(
n));
73 std::map<GraphInputIndex, loco::Node *> table;
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;
94 auto it = table.find(
n);
95 res.emplace_back(
it == table.end() ?
nullptr :
it->second);
103 std::map<GraphOutputIndex, loco::Node *> table;
107 auto node = g->nodes()->at(
n);
111 if (service->associated(node))
120 std::vector<loco::Node *>
res;
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::vector< int > dims(const std::string &src)
std::set< Node * > all_nodes(Graph *)
Enumerate all the nodes in a given graph.
std::vector< Node * > input_nodes(const Graph *)
T must_cast(FeatureEncoder *node)
A helper dynamic_cast that throws when failed.
std::vector< Node * > output_nodes(Graph *)
std::unique_ptr< Graph > make_graph(void)
GraphInput * create(void)
GraphOutput * create(void)