[moco-tf] Introduce node_shape_with_check helper (#7993)
author박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Wed, 9 Oct 2019 22:07:12 +0000 (07:07 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 9 Oct 2019 22:07:12 +0000 (07:07 +0900)
This will introduce node_shape_with_check() helper in TFShapeInferenceRule for getting node_shape of a node and revise for TFBiasAdd node

Signed-off-by: SaeHie Park <saehie.park@samsung.com>
compiler/moco-tf/src/Dialect/TFShapeInferenceRule.cpp

index 8e7b584..3ddf8f4 100644 (file)
@@ -64,6 +64,14 @@ private:
     return sum_shape;
   }
 
+  loco::NodeShape node_shape_with_check(const moco::tf::TFNode::Node *node)
+  {
+    auto nodeshape = node_shape(node);
+    assert(nodeshape.domain() == loco::Domain::Tensor);
+
+    return nodeshape;
+  }
+
   bool valid_scala_value(moco::tf::TFConst *node)
   {
     auto nodeshape = node_shape(node);
@@ -122,10 +130,7 @@ public:
 
   loco::NodeShape visit(const moco::tf::TFBiasAdd *node) final
   {
-    auto value_shape = node_shape(node->value());
-    assert(value_shape.domain() != loco::Domain::Unknown);
-
-    return value_shape;
+    return node_shape_with_check(node->value());
   }
 
   loco::NodeShape visit(const moco::tf::TFConcatV2 *node) final