[model_parser] Change `GetBuiltinOptions` usage (#2072)
author이한종/동작제어Lab(SR)/Engineer/삼성전자 <hanjoung.lee@samsung.com>
Wed, 25 Jul 2018 08:34:12 +0000 (17:34 +0900)
committer박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Wed, 25 Jul 2018 08:34:12 +0000 (17:34 +0900)
* [model_parser] Rename `GetBuiltinOptions` and usage

Rename `GetBuiltinOptions` to `GetOptions` and change the arguments.

Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
* Revert renaming

Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
tools/tflitefile_tool/operator_wrapping.py

index 6802daa..ff5b47b 100755 (executable)
@@ -34,7 +34,8 @@ def GetStrTensorIndex(tensors):
     return return_string
 
 
-def GetBuiltinOptions(tf_operator):
+# NOTE Currently not all builtin operations are supported
+def GetBuiltinOptions(options_type, options_table):
     import tflite.Conv2DOptions
     import tflite.DepthwiseConv2DOptions
     import tflite.Pool2DOptions
@@ -72,8 +73,7 @@ def GetBuiltinOptions(tf_operator):
         bo.GatherOptions: tflite.GatherOptions.GatherOptions
     }
 
-    options_table = tf_operator.BuiltinOptions()
-    options = bo_gen[tf_operator.BuiltinOptionsType()]()
+    options = bo_gen[options_type]()
     options.Init(options_table.Bytes, options_table.Pos)
     return options
 
@@ -114,7 +114,8 @@ class Operator(object):
     def PrintOptionInfo(self):
         # FIXME: workaround for ops such as custom
         try:
-            options = GetBuiltinOptions(self.tf_operator)
+            options = GetBuiltinOptions(self.tf_operator.BuiltinOptionsType(),
+                                        self.tf_operator.BuiltinOptions())
         except KeyError:
             return