[moco-tf] implementing make_graph_builder_registry(..) function (#6175)
author윤현식/On-Device Lab(SR)/Principal Engineer/삼성전자 <hyunsik.yoon@samsung.com>
Mon, 5 Aug 2019 00:15:28 +0000 (09:15 +0900)
committer박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Mon, 5 Aug 2019 00:15:28 +0000 (09:15 +0900)
This adds `make_graph_builder_registry(..)` function, which makes graph builder registry that finds custom op graph builder and then searches into the default registry.

Signed-off-by: Hyun Sik Yoon <hyunsik.yoon@samsung.com>
compiler/moco-tf/src/Frontend.cpp

index 75b1a69..d62b9c9 100644 (file)
@@ -24,6 +24,8 @@
 
 #include "Transforms.h"
 
+#include "Op/COpCall.h"
+
 #include <cwrap/Fildes.h>
 #include <stdex/Memory.h>
 
@@ -108,7 +110,13 @@ moco::tf::GraphBuilderRegistry make_graph_builder_registry(const moco::tf::Model
 {
   moco::tf::GraphBuilderRegistry registry{&moco::tf::GraphBuilderRegistry::get()};
 
-  // TODO add GraphBuilder for Custom op into registry
+  // build a COpCallGraphBuilder per custom op type
+  for (const auto &custom_op : sig.customops())
+  {
+    std::unique_ptr<moco::tf::COpCallGraphBuilder> builder =
+        stdex::make_unique<moco::tf::COpCallGraphBuilder>(&sig);
+    registry.add(custom_op, std::move(builder));
+  }
 
   return registry;
 }