54{
56 return false;
57
58 auto ptr_to_str = [](const void *ptr) {
59 std::stringstream ss;
60 ss << ptr;
61 return ss.str();
62 };
63
65 std::stringstream ss;
66 ss << "<";
67 for (uint32_t i = 0; i < node->rank(); ++i)
68 {
69 if (i)
70 ss << ",";
71 ss << (node->dim(i).known() ? node->dim(i).value() : -1);
72 }
73 ss << ">";
74 return ss.str();
75 };
76
77 auto circle_node = loco::must_cast<const luci::CircleNode *>(node);
78 if (const auto builder = create_builder(circle_node))
79 {
80 if (!builder->validate(circle_node))
81 {
83 return false;
84 }
85
86 auto input_names = builder->get_input_names(circle_node);
87 assert(node->
arity() == input_names.size());
88 for (uint32_t i = 0; i < node->
arity(); ++i)
89 s.args().append(input_names.at(i), tbl->
lookup(node->
arg(i)));
90
91 builder->build_attributes(circle_node, s);
92 builder->update_status(s);
93
94 s.opname(circle_opname(circle_node->opcode()));
95 s.comments().append(
"[" + circle_node->name() +
" " + shape_to_str(circle_node) +
96 "] = " + ptr_to_str(node));
97
98 return true;
99 }
100 else
101 {
102
103 return false;
104 }
105}
virtual Node * arg(uint32_t N) const =0
Access N-th argument node.
virtual uint32_t arity(void) const =0
Return the number of arguments.
virtual const Dialect * dialect(void) const =0
Return "Dialect" identifier that this node belongs to.
static loco::Dialect * get(void)
virtual std::string lookup(const loco::Node *) const =0