[enco] frontend/caffe: move loop invariant context (#2589)
author박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Mon, 10 Dec 2018 08:02:45 +0000 (17:02 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 10 Dec 2018 08:02:45 +0000 (17:02 +0900)
This will move loop invariant opbuilder_context variable outside of the for loop

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

index ac3dbab..c72bcab 100644 (file)
@@ -107,6 +107,9 @@ enco::Bundle Frontend::load(void) const
     return res;
   };
 
+  caffeimport::GraphBuilderContext opbuilder_context(module.get(), data.get(), blk, shape_ctx,
+                                                     bag_ctx, weight_ctx);
+
   for (const auto &layer : _prototxt->layer())
   {
     assert(layer.has_name());
@@ -122,9 +125,6 @@ enco::Bundle Frontend::load(void) const
       use(layer.bottom(n));
     }
 
-    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);