[enco/tfl/frontend] Creation of context ob outside of loop (#2442)
author윤현식/동작제어Lab(SR)/Principal Engineer/삼성전자 <hyunsik.yoon@samsung.com>
Thu, 29 Nov 2018 05:50:41 +0000 (14:50 +0900)
committer박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Thu, 29 Nov 2018 05:50:41 +0000 (14:50 +0900)
This commit moves creation of context ob outside of loop.
(putting creation code inside loop creates same object over and over)

Signed-off-by: Hyun Sik Yoon <hyunsik.yoon@samsung.com>
contrib/enco/frontend/tflite/src/Frontend.cpp

index 8f2953d..90620b3 100644 (file)
@@ -117,14 +117,14 @@ enco::Bundle Frontend::load(void) const
 
   auto operators = graph->operators();
 
+  tflimport::GraphBuilderContext opbuilder_context(m.get(), d.get(), blk, tensor_bags,
+                                                   tensor_context, buffer_context, graph);
+
   for (int i = 0; i < operators->Length(); ++i)
   {
     const auto *op = operators->Get(i);
     tflite::BuiltinOperator builtincode = opcode_context.builtin_code(op);
 
-    tflimport::GraphBuilderContext opbuilder_context(m.get(), d.get(), blk, tensor_bags,
-                                                     tensor_context, buffer_context, graph);
-
     if (const auto *graph_builder = tflimport::GraphBuilderRegistry::get().lookup(builtincode))
     {
       graph_builder->build(op, &opbuilder_context);