You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/12/16 09:12:40 UTC

[GitHub] [tvm] giuseros commented on a change in pull request #7114: [TFLite] Added check for dynamic range quantization

giuseros commented on a change in pull request #7114:
URL: https://github.com/apache/tvm/pull/7114#discussion_r544131339



##########
File path: python/tvm/relay/frontend/tflite.py
##########
@@ -174,17 +174,42 @@ def __init__(self, model, subgraph, exp_tab):
     def check_unsupported_ops(self):
         """Check unsupported TFLite ops in our converter."""
         unsupported_ops_set = set()
-
+        dynamic_range_ops_set = set()
         for op_idx in range(self.subgraph.OperatorsLength()):
             op = self.subgraph.Operators(op_idx)
             op_code_str = self.get_op_code_str(op)
             if op_code_str not in self.convert_map:
                 unsupported_ops_set.add(op_code_str)
+                continue
+
+            # Trying to exclude "dynamic range quantization" optimized ops as not supported in TVM
+            qnn_in_cnt = len(
+                [_.qnn_params for _ in self.get_input_tensors(op)[1:] if _.qnn_params is not None]
+            )
+            qnn_out_cnt = len(
+                [_.qnn_params for _ in self.get_output_tensors(op) if _.qnn_params is not None]
+            )
+
+            if qnn_out_cnt == 0 and qnn_in_cnt > 0:
+                dynamic_range_ops_set.add(op_code_str)

Review comment:
       Could you perhaps be a bit more explicit and have a condition like:
   ```
   input_quantized =  self.get_input_tensors(op)[0].qnn_params is not None 
   weights_quantized =  self.get_input_tensors(op)[1].qnn_params is not None 
   
   if not input_quantized and weights_quantized
       dynamic_range_ops-set.add(op_code_str)
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org