[moco-tf] Prepare to handle TFPush instead of Push (#8636)
author박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Thu, 31 Oct 2019 04:43:20 +0000 (13:43 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Thu, 31 Oct 2019 04:43:20 +0000 (13:43 +0900)
This will update Frontend to support output as TFPush and Push while updating to produce TFPush as Output

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

index 20bfab2..ea236c7 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <moco/tf/Frontend.h>
 #include <moco/Import/Importer.h>
+#include <moco/IR/TFNode.h>
 #include <moco/Log.h>
 
 #include "GraphBuilderRegistry.h"
@@ -274,9 +275,22 @@ std::unique_ptr<loco::Graph> Frontend::import(const ModelSignature &signature,
   for (uint32_t n = 0; n < graph->outputs()->size(); ++n)
   {
     auto output = graph->outputs()->at(n);
-    auto output_node = loco::push_node(graph.get(), n);
+    auto output_node = moco::push_node(graph.get(), n);
+    // TODO remove handle loco::push after changing Import in moco to generate TFPush
+    if (output_node == nullptr)
+    {
+      auto output_node = loco::push_node(graph.get(), n);
+      assert(output_node != nullptr);
+      output->shape(stdex::make_unique<loco::TensorShape>(::tensor_shape(output_node)));
+    }
+    else
+    {
+      output->shape(stdex::make_unique<loco::TensorShape>(::tensor_shape(output_node)));
+    }
+#if 0
     assert(output_node != nullptr);
-    output->shape(stdex::make_unique<loco::TensorShape>(tensor_shape(output_node)));
+    output->shape(stdex::make_unique<loco::TensorShape>(::tensor_shape(output_node)));
+#endif // 0
   }
 
   // Convert graph to hold only Canonical dialect