From 384bc13c9a38e7f1c5d60374b0a2ef4f4054d3f5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Fri, 9 Aug 2019 10:18:12 +0900 Subject: [PATCH] [locop] Introduce push_shape/pull_shape helper (#6398) Let's replace tensor_shape with push_shape/pull_shape as the first step to remove shape attribtues from Pull/Push node. Signed-off-by: Jonghyun Park --- compiler/locop/src/CanonicalNodeSummaryBuilder.cpp | 32 ++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/compiler/locop/src/CanonicalNodeSummaryBuilder.cpp b/compiler/locop/src/CanonicalNodeSummaryBuilder.cpp index 7335a66..9b762b2 100644 --- a/compiler/locop/src/CanonicalNodeSummaryBuilder.cpp +++ b/compiler/locop/src/CanonicalNodeSummaryBuilder.cpp @@ -62,6 +62,34 @@ loco::TensorShape tensor_shape(const loco::NodeMixinrank()); + + for (uint32_t axis = 0; axis < m->rank(); ++axis) + { + res.dim(axis) = m->dim(axis); + } + + return res; +} + +loco::TensorShape pull_shape(const loco::Pull *m) +{ + loco::TensorShape res; + + res.rank(m->rank()); + + for (uint32_t axis = 0; axis < m->rank(); ++axis) + { + res.dim(axis) = m->dim(axis); + } + + return res; +} + std::ostream &operator<<(std::ostream &os, const loco::Dimension &d) { os << (d.known() ? std::to_string(d.value()) : std::string{"?"}); @@ -193,7 +221,7 @@ public: res.arg("index", node->indexed() ? pp::fmt(node->index()) : pp::fmt('?')); res.arg("from", symbol_lookup(*_symtbl, node->from())); - res.arg("shape", pp::fmt(pretty(tensor_shape(node)))); + res.arg("shape", pp::fmt(pretty(push_shape(node)))); res.state(NodeDesc::State::Complete); return res; @@ -205,7 +233,7 @@ public: res.arg("index", node->indexed() ? pp::fmt(node->index()) : pp::fmt('?')); // TODO Print dtype - res.arg("shape", pp::fmt(pretty(tensor_shape(node)))); + res.arg("shape", pp::fmt(pretty(pull_shape(node)))); res.state(NodeDesc::State::PartiallyKnown); return res; -- 2.7.4