From 63787d081fe71295819ee2c0d9c29b814f555334 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=84=B8=ED=9D=AC/On-Device=20Lab=28SR=29/Princip?= =?utf8?q?al=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Wed, 24 Jul 2019 19:56:08 +0900 Subject: [PATCH] [moco-tf] setup_output_node for unittest (#5828) * [moco-tf] setup_output_node for unittest This will introduce setup_output_node() in test helper to add Push node as graph outputs Signed-off-by: SaeHie Park * edit comment --- compiler/moco-tf/src/TestHelper.cpp | 13 +++++++++++++ compiler/moco-tf/src/TestHelper.h | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/compiler/moco-tf/src/TestHelper.cpp b/compiler/moco-tf/src/TestHelper.cpp index 4e6fb4f..c53b13d 100644 --- a/compiler/moco-tf/src/TestHelper.cpp +++ b/compiler/moco-tf/src/TestHelper.cpp @@ -36,6 +36,19 @@ bool parse_graphdef(char const *pbtxt, tensorflow::GraphDef &graphdef) return google::protobuf::TextFormat::Parse(&iis, &graphdef); } +void setup_output_node(loco::Graph *graph, loco::Node *last_node) +{ + // add push as output + auto push_node = graph->nodes()->create(); + push_node->from(last_node); + + // set the graph output name and node object + auto graph_output = graph->outputs()->create(); + graph_output->name("output"); + graph_output->dtype(loco::DataType::FLOAT32); + graph_output->node(push_node); +} + } // namespace test } // namespace tf } // namespace moco diff --git a/compiler/moco-tf/src/TestHelper.h b/compiler/moco-tf/src/TestHelper.h index 494522a..b3dfe91 100644 --- a/compiler/moco-tf/src/TestHelper.h +++ b/compiler/moco-tf/src/TestHelper.h @@ -83,6 +83,13 @@ template std::vector find_nodes_bytype(loco::Graph *g) return find_nodes; } +/** + * @brief Append setup output of graph by adding loco::Push node + * + * @note This is subject to change when loco changes I/O treatment + */ +void setup_output_node(loco::Graph *graph, loco::Node *last_node); + } // namespace test } // namespace tf } // namespace moco -- 2.7.4