masahi commented on a change in pull request #4880: [QNN] Add support for per 
channel weight scale in dense op
URL: https://github.com/apache/incubator-tvm/pull/4880#discussion_r379280705
 
 

 ##########
 File path: python/tvm/relay/frontend/tflite.py
 ##########
 @@ -982,13 +982,15 @@ def convert_fully_connected(self, op):
 
         weight_value = self.get_tensor_value(weight_tensor)
         weight_expr = self.exp_tab.new_const(weight_value, 
dtype=weight_tensor_type_str)
+        weight_shape = _infer_shape(weight_expr)
 
         if input_tensor.qnn_params:
             out = _qnn.op.dense(in_expr, weight_expr,
                                 
input_zero_point=input_tensor.qnn_params['zero_point'],
                                 
kernel_zero_point=weight_tensor.qnn_params['zero_point'],
                                 input_scale=input_tensor.qnn_params['scale'],
                                 kernel_scale=weight_tensor.qnn_params['scale'],
+                                units=weight_shape[1],
 
 Review comment:
   I think units is supposed to mean output dimension (the dimension that 
weight scale is applied). If `n` is the output dimension, then yes.
   
   From the test cases in 
https://github.com/apache/incubator-tvm/blob/70c63829474649f34928d42948bf3e5c7dbfbd75/tests/python/frontend/tflite/test_forward.py#L1381-L1384,
 I guessed that `weight_shape[1]` is the output dimension.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to