From aaa342599a244430eeb9634ecb18e92a292efba9 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: Tue, 20 Aug 2019 16:05:03 +0900 Subject: [PATCH] [exo-tflite] Do NOT invoke GraphInput/Output node (#6717) 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 --- compiler/exo-tflite/src/ExporterUtils.cpp | 4 ++-- compiler/exo-tflite/src/TFLExporterImpl.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/exo-tflite/src/ExporterUtils.cpp b/compiler/exo-tflite/src/ExporterUtils.cpp index 1244560..d001cef 100644 --- a/compiler/exo-tflite/src/ExporterUtils.cpp +++ b/compiler/exo-tflite/src/ExporterUtils.cpp @@ -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; diff --git a/compiler/exo-tflite/src/TFLExporterImpl.cpp b/compiler/exo-tflite/src/TFLExporterImpl.cpp index 69d3ebe..f15f897 100644 --- a/compiler/exo-tflite/src/TFLExporterImpl.cpp +++ b/compiler/exo-tflite/src/TFLExporterImpl.cpp @@ -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)); } -- 2.7.4