[moco-tf] relocate input method in Concat import (#6394)
author박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Thu, 8 Aug 2019 07:58:52 +0000 (16:58 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Thu, 8 Aug 2019 07:58:52 +0000 (16:58 +0900)
This will relocate input method in Concat after class declaration to put anonymous codes together

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

index bbdfb45..7f81cce 100644 (file)
@@ -70,6 +70,44 @@ private:
   std::vector<TensorName> _names;
 };
 
+void ConcatV2GraphUpdate::input(const SymbolTable *tensor_names) const
+{
+  int num_inputs = _names.size();
+  assert(num_inputs >= 2);
+  assert(num_inputs == _nodes.size());
+
+  loco::Node *target;
+  // do "%0.lhs : %in[0].name" connection
+  target = tensor_names->node(_names[0]);
+  _nodes[0]->lhs(target);
+
+  for (int i = 1; i < num_inputs; ++i)
+  {
+    // do "%i.rhs : %in[i].name" connections
+    target = tensor_names->node(_names[i]);
+    _nodes[i]->rhs(target);
+  }
+}
+
+void TFConcatV2GraphUpdate::input(const SymbolTable *tensor_names) const
+{
+  int num_inputs = _names.size();
+  assert(num_inputs >= 2);
+  assert(num_inputs == _nodes.size());
+
+  loco::Node *target;
+  // do "%0.lhs : %in[0].name" connection
+  target = tensor_names->node(_names[0]);
+  _nodes[0]->lhs(target);
+
+  for (int i = 1; i < num_inputs; ++i)
+  {
+    // do "%i.rhs : %in[i].name" connections
+    target = tensor_names->node(_names[i]);
+    _nodes[i]->rhs(target);
+  }
+}
+
 } // namespace
 
 namespace moco
@@ -302,50 +340,6 @@ void ConcatV2GraphBuilderImpl<ImportTarget::TensorFlow>::build(const tensorflow:
 } // namespace tf
 } // namespace moco
 
-// TODO move this block to upperside
-namespace
-{
-
-void ConcatV2GraphUpdate::input(const SymbolTable *tensor_names) const
-{
-  int num_inputs = _names.size();
-  assert(num_inputs >= 2);
-  assert(num_inputs == _nodes.size());
-
-  loco::Node *target;
-  // do "%0.lhs : %in[0].name" connection
-  target = tensor_names->node(_names[0]);
-  _nodes[0]->lhs(target);
-
-  for (int i = 1; i < num_inputs; ++i)
-  {
-    // do "%i.rhs : %in[i].name" connections
-    target = tensor_names->node(_names[i]);
-    _nodes[i]->rhs(target);
-  }
-}
-
-void TFConcatV2GraphUpdate::input(const SymbolTable *tensor_names) const
-{
-  int num_inputs = _names.size();
-  assert(num_inputs >= 2);
-  assert(num_inputs == _nodes.size());
-
-  loco::Node *target;
-  // do "%0.lhs : %in[0].name" connection
-  target = tensor_names->node(_names[0]);
-  _nodes[0]->lhs(target);
-
-  for (int i = 1; i < num_inputs; ++i)
-  {
-    // do "%i.rhs : %in[i].name" connections
-    target = tensor_names->node(_names[i]);
-    _nodes[i]->rhs(target);
-  }
-}
-
-} // namespace
-
 #include "GraphBuilderRegistry.h"
 
 REGISTER_OP_BUILDER(ConcatV2, ConcatV2GraphBuilder)