[tfltool] OP selector: Support more operator (#2975)
author오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Fri, 5 Oct 2018 04:14:51 +0000 (13:14 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Fri, 5 Oct 2018 04:14:51 +0000 (13:14 +0900)
Support selecting operators: NEG, EXP

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
tools/tflitefile_tool/select_operator.py

index ae0d33c..54586ae 100755 (executable)
@@ -465,7 +465,15 @@ def GenerateBuiltinOption(new_builder, selected_builtin_option, builtin_option_t
 
         return tflite.StridedSliceOptions.StridedSliceOptionsEnd(new_builder)
 
-    # ExpOptions: not supported
+    # ExpOptions
+    import tflite.ExpOptions
+    if builtin_option_type == tflite.BuiltinOptions.BuiltinOptions().ExpOptions:
+
+        exp_option = tflite.ExpOptions.ExpOptions()
+        exp_option.Init(selected_builtin_option.Bytes, selected_builtin_option.Pos)
+
+        tflite.ExpOptions.ExpOptionsStart(new_builder)
+        return tflite.ExpOptions.ExpOptionsEnd(new_builder)
 
     # TopKV2Options
     import tflite.TopKV2Options
@@ -494,7 +502,17 @@ def GenerateBuiltinOption(new_builder, selected_builtin_option, builtin_option_t
     # MaximumMinimumOptions: not supported
     # ArgMaxOptions: not supported
     # LessOptions: not supported
-    # NegOptions: not supported
+
+    # NegOptions
+    import tflite.NegOptions
+    if builtin_option_type == tflite.BuiltinOptions.BuiltinOptions().NegOptions:
+
+        neg_option = tflite.NegOptions.NegOptions()
+        neg_option.Init(selected_builtin_option.Bytes, selected_builtin_option.Pos)
+
+        tflite.NegOptions.NegOptionsStart(new_builder)
+        return tflite.NegOptions.NegOptionsEnd(new_builder)
+
     # PadV2Options: not supported
     # GreaterOptions: not supported
     # GreaterEqualOptions: not supported