[moco] Placeholder as TFPlaceholder (#8375)
author박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Tue, 22 Oct 2019 03:35:36 +0000 (12:35 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 22 Oct 2019 03:35:36 +0000 (12:35 +0900)
This will import TensorFlow Placeholder node as TFPlaceholder IR instead of loco::Pull

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

index 78bf775..6b2e732 100644 (file)
@@ -16,6 +16,8 @@
 
 #include "moco/Import/Nodes/Placeholder.h"
 
+#include <moco/IR/Nodes/TFPlaceholder.h>
+
 #include <moco/Names.h>
 #include <plier/tf/Convert.h>
 
@@ -47,13 +49,13 @@ void PlaceholderGraphBuilder::build(const tensorflow::NodeDef &node,
   // TODO support other types
   assert(dtype == loco::DataType::FLOAT32);
 
-  // Create a "pull" node as an input
-  auto pull_node = graph->nodes()->create<loco::Pull>();
+  // Create a "Placeholder" node as an input
+  auto placeholder_node = graph->nodes()->create<moco::TFPlaceholder>();
 
-  pull_node->dtype(dtype);
+  placeholder_node->dtype(dtype);
 
   // Setting shape info.
-  pull_node->rank(num_dims);
+  placeholder_node->rank(num_dims);
   for (int64_t d = 0; d < num_dims; d++)
   {
     assert(shape.dim(d).size() < std::numeric_limits<uint32_t>::max());
@@ -61,11 +63,11 @@ void PlaceholderGraphBuilder::build(const tensorflow::NodeDef &node,
     if (dim_value >= 0)
     {
       uint32_t dim_value32 = static_cast<uint32_t>(dim_value);
-      pull_node->dim(d) = dim_value32;
+      placeholder_node->dim(d) = dim_value32;
     }
     else
     {
-      pull_node->dim(d).unset();
+      placeholder_node->dim(d).unset();
       // TODO Remove assert() and do implement
       // NOTE Current implementation assumes dim is all know
       assert(false);
@@ -74,7 +76,7 @@ void PlaceholderGraphBuilder::build(const tensorflow::NodeDef &node,
 
   // register string-name to node
   TensorName output_name(node.name(), 0);
-  tensor_names->enroll(output_name, pull_node);
+  tensor_names->enroll(output_name, placeholder_node);
 }
 
 } // namespace moco