[enco] frontend/caffe: Prepare to use GraphBuilder (#2538)
author박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Thu, 6 Dec 2018 09:37:58 +0000 (18:37 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Thu, 6 Dec 2018 09:37:58 +0000 (18:37 +0900)
This will add using GraphBuilderRegistry to prepare handling by each layer GraphBuilder

Signed-off-by: SaeHie Park <saehie.park@samsung.com>
contrib/enco/frontend/caffe/src/Frontend.cpp

index e5e80cb..d6532d2 100644 (file)
@@ -21,6 +21,7 @@
 #include "IRBuilder.h"
 #include "Context.h"
 #include "Convert.h"
+#include "GraphBuilderRegistry.h"
 
 #include <coco/IR/FeatureLayouts.h>
 #include <coco/IR/KernelLayouts.h>
@@ -122,7 +123,15 @@ enco::Bundle Frontend::load(void) const
       use(layer.bottom(n));
     }
 
-    if (layer.type() == "Input")
+    caffeimport::GraphBuilderContext opbuilder_context(module.get(), data.get(), blk, shape_ctx,
+                                                       bag_ctx, weight_ctx);
+
+    if (const auto *graph_builder = caffeimport::GraphBuilderRegistry::get().lookup(layer.type()))
+    {
+      graph_builder->build(layer, &opbuilder_context);
+    }
+    // TODO move type handlers to separate builder
+    else if (layer.type() == "Input")
     {
       assert(layer.has_input_param());
       const auto &param = layer.input_param();