Fix pylint warning in tflitefile_tool (#5606)
author오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Thu, 11 Jul 2019 06:14:35 +0000 (15:14 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Thu, 11 Jul 2019 06:14:35 +0000 (15:14 +0900)
Fix pylint warning in tflitefile_tool
- "dummy_" prefix for unused variable
- staticmethod keyword for static method
- Use sharp for comment instead of triple quote

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

index 127d6c5..7d04a01 100755 (executable)
@@ -55,6 +55,7 @@ class _OperationComputeMethod(object):
     Anyway, we can calculate total operations on this way. This can apply to the way of pooling.
     '''
 
+    @staticmethod
     def ComputeOperationForConv2D(tf_operator, inputs, outputs):
         assert (
             tf_operator.BuiltinOptionsType() == tflite.BuiltinOptions.BuiltinOptions()
@@ -83,16 +84,15 @@ class _OperationComputeMethod(object):
         nonlinear_instr_num = 0
         return (add_instr_num, mul_instr_num, nonlinear_instr_num)
 
-    '''
-    NOTE: Reference the comment 'NOTE' of ComputeOperationForConv2D
-    '''
+    # NOTE: Reference the comment 'NOTE' of ComputeOperationForConv2D
 
+    @staticmethod
     def ComputeOperationForPooling(tf_operator, inputs, outputs):
         assert (
             tf_operator.BuiltinOptionsType() == tflite.BuiltinOptions.BuiltinOptions()
             .Pool2DOptions)
 
-        input_tensor = inputs[0].tf_tensor
+        dummy_input_tensor = inputs[0].tf_tensor
         output_tensor = outputs[0].tf_tensor
 
         pool2d_options = tflite.Pool2DOptions.Pool2DOptions()
@@ -113,6 +113,7 @@ class _OperationComputeMethod(object):
         nonlinear_instr_num = 0
         return (add_instr_num, mul_instr_num, nonlinear_instr_num)
 
+    @staticmethod
     def ComputeOperationForSoftmax(tf_operator, inputs, outputs):
         assert (
             tf_operator.BuiltinOptionsType() == tflite.BuiltinOptions.BuiltinOptions()
@@ -120,7 +121,7 @@ class _OperationComputeMethod(object):
 
         input_tensor = inputs[0].tf_tensor
 
-        batch_size = input_tensor.Shape(0)
+        dummy_batch_size = input_tensor.Shape(0)
         input_dim = input_tensor.Shape(1)
 
         # Softmax(x_i) = exp(x_i) / sum of exp(x)
@@ -129,6 +130,7 @@ class _OperationComputeMethod(object):
         nonlinear_instr_num = input_dim + input_dim  # sum of exp(x) and exp(x_i)
         return (add_instr_num, mul_instr_num, nonlinear_instr_num)
 
+    @staticmethod
     def ComputeOperationForFullyConnected(tf_operator, inputs, outputs):
         assert (
             tf_operator.BuiltinOptionsType() == tflite.BuiltinOptions.BuiltinOptions()
@@ -150,12 +152,14 @@ class _OperationComputeMethod(object):
         nonlinear_instr_num = 0
         return (add_instr_num, mul_instr_num, nonlinear_instr_num)
 
+    @staticmethod
     def ComputeOperationForNothing(tf_operator, inputs, outputs):
         add_instr_num = 0
         mul_instr_num = 0
         nonlinear_instr_num = 0
         return (add_instr_num, mul_instr_num, nonlinear_instr_num)
 
+    @staticmethod
     def NYI_ComputeOperation(tf_operator, inputs, outputs):
         pass