return os;
}
-std::ostream &operator<<(std::ostream &os, const loco::TensorShape &shape)
+class FormattedTensorShape
{
+public:
+ FormattedTensorShape(const loco::TensorShape *ptr) : _ptr{ptr}
+ {
+ // DO NOTHING
+ }
+
+public:
+ const loco::TensorShape &get(void) const { return *_ptr; }
+
+private:
+ const loco::TensorShape *_ptr;
+};
+
+inline FormattedTensorShape pretty(const loco::TensorShape &shape)
+{
+ return FormattedTensorShape{&shape};
+}
+
+std::ostream &operator<<(std::ostream &os, const FormattedTensorShape &f)
+{
+ const auto &shape = f.get();
+
os << "[";
if (shape.rank() > 0)
NodeDesc res{opname(node)};
res.arg("from", symbol_lookup(*_symtbl, node->from()));
- res.arg("shape", pp::fmt(tensor_shape(node)));
+ res.arg("shape", pp::fmt(pretty(tensor_shape(node))));
res.state(NodeDesc::State::Complete);
return res;
NodeDesc res{opname(node)};
// TODO Print dtype
- res.arg("shape", pp::fmt(tensor_shape(node)));
+ res.arg("shape", pp::fmt(pretty(tensor_shape(node))));
res.state(NodeDesc::State::PartiallyKnown);
return res;
NodeDesc res{opname(node)};
// TODO Print data type
- res.arg("shape", pp::fmt(tensor_shape(node)));
+ res.arg("shape", pp::fmt(pretty(tensor_shape(node))));
res.state(NodeDesc::State::PartiallyKnown);
return res;