[moco] register op and do convert (#3329)
author박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Mon, 22 Apr 2019 01:49:24 +0000 (10:49 +0900)
committer박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Mon, 22 Apr 2019 01:49:24 +0000 (10:49 +0900)
This will register two operators conversion and enable conversion

Signed-off-by: SaeHie Park <saehie.park@samsung.com>
contrib/moco/lib/frontend/tf/src/Frontend.cpp
contrib/moco/lib/frontend/tf/src/GraphBuilderRegistry.h

index 26620f0..f687144 100644 (file)
@@ -207,23 +207,7 @@ std::unique_ptr<loco::Graph> Frontend::load(const ModelSignature &signature, con
 
   auto graph = loco::make_graph();
 
-  // TODO convert tf_graph_def
-  for (const auto &n : tf_graph_def.node())
-  {
-    if (const auto *graph_builder = GraphBuilderRegistry::get().lookup(n.op()))
-    {
-      if (!graph_builder->validate(n))
-      {
-        throw std::runtime_error{"Invalid operator: " + n.op()};
-      }
-
-      // TODO call build
-    }
-    else
-    {
-      // TODO handle for not supported op
-    }
-  }
+  convert_graph(signature, tf_graph_def, graph.get());
 
   return std::move(graph);
 }
index 48d2d1f..44de16a 100644 (file)
 
 #include "GraphBuilder.h"
 
+#include "Op/Placeholder.h"
+#include "Op/Identity.h"
+
+#include <stdex/Memory.h>
+
 #include <map>
 #include <memory>
 #include <string>
@@ -55,7 +60,8 @@ public:
 private:
   GraphBuilderRegistry()
   {
-    // TODO fill in GraphBuilders
+    _builder_map["Placeholder"] = stdex::make_unique<PlaceholderGraphBuilder>();
+    _builder_map["Identity"] = stdex::make_unique<IdentityGraphBuilder>();
   }
 
 private: