[exo-tflite] Do NOT invoke GraphInput/Output node (#6717)
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Tue, 20 Aug 2019 07:05:03 +0000 (16:05 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 20 Aug 2019 07:05:03 +0000 (16:05 +0900)
This commit removes all the GraphInput::node and GraphOutput::node
method calls in exo-tflite. This is a step toward loco GraphInput/Output
class redesign.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
compiler/exo-tflite/src/ExporterUtils.cpp
compiler/exo-tflite/src/TFLExporterImpl.cpp

index 1244560..d001cef 100644 (file)
@@ -152,14 +152,14 @@ void registerGraphIOName(loco::Graph *graph, SerializedModelData &gd)
 {
   for (uint32_t in = 0; in < graph->inputs()->size(); ++in)
   {
-    auto pull = graph->inputs()->at(in)->node();
+    auto pull = loco::pull_node(graph, in);
     auto name = graph->inputs()->at(in)->name();
 
     gd._pull_to_name[pull] = name;
   }
   for (uint32_t out = 0; out < graph->outputs()->size(); ++out)
   {
-    auto push = graph->outputs()->at(out)->node();
+    auto push = loco::push_node(graph, out);
     auto name = graph->outputs()->at(out)->name();
 
     gd._push_to_name[push] = name;
index 69d3ebe..f15f897 100644 (file)
@@ -34,7 +34,7 @@ void registerGraphInputTensors(loco::Graph *graph, SubGraphContext &ctx)
 {
   for (uint32_t n = 0; n < graph->inputs()->size(); ++n)
   {
-    auto node = graph->inputs()->at(n)->node();
+    auto node = loco::pull_node(graph, n);
     assert(node != nullptr);
     ctx._inputs.push_back(get_tensor_index(node));
   }
@@ -44,7 +44,9 @@ void registerGraphOutputTensors(loco::Graph *graph, SubGraphContext &ctx)
 {
   for (uint32_t n = 0; n < graph->outputs()->size(); ++n)
   {
-    auto node = graph->outputs()->at(n)->node()->from();
+    auto push = loco::push_node(graph, n);
+    assert(push != nullptr);
+    auto node = push->from();
     assert(node != nullptr);
     ctx._outputs.push_back(get_tensor_index(node));
   }