[moco-tf] Do NOT invoke GraphInput/Output node (#6716)
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Tue, 20 Aug 2019 07:02:38 +0000 (16:02 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 20 Aug 2019 07:02:38 +0000 (16:02 +0900)
As a step to loco redesign, this commit removes all
GraphInput::node and GraphOutput::node method calls in moco-tf.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
compiler/moco-tf/src/Frontend.cpp
compiler/moco-tf/src/Importer.cpp

index d62b9c9..a0bf1b6 100644 (file)
@@ -257,13 +257,15 @@ std::unique_ptr<loco::Graph> Frontend::import(const ModelSignature &signature,
   for (uint32_t n = 0; n < graph->inputs()->size(); ++n)
   {
     auto input = graph->inputs()->at(n);
-    input->shape(stdex::make_unique<loco::TensorShape>(tensor_shape(input->node())));
+    auto input_node = loco::pull_node(graph.get(), n);
+    input->shape(stdex::make_unique<loco::TensorShape>(tensor_shape(input_node)));
   }
 
   for (uint32_t n = 0; n < graph->outputs()->size(); ++n)
   {
     auto output = graph->outputs()->at(n);
-    output->shape(stdex::make_unique<loco::TensorShape>(tensor_shape(output->node())));
+    auto output_node = loco::push_node(graph.get(), n);
+    output->shape(stdex::make_unique<loco::TensorShape>(tensor_shape(output_node)));
   }
 
   // Convert graph to hold only Canonical dialect
index 85f4073..e1418fb 100644 (file)
@@ -240,7 +240,7 @@ void transform_graph(loco::Graph *graph)
   {
     for (uint32_t i = 0; i < graph->outputs()->size(); ++i)
     {
-      loco::Node *node = graph->outputs()->at(i)->node();
+      loco::Node *node = loco::push_node(graph, i);
       std::string name = "Output(" + std::to_string(i) + ")";
       dump_shapeinferencedata(node, name);
     }