masahi commented on code in PR #13578:
URL: https://github.com/apache/tvm/pull/13578#discussion_r1043839934


##########
python/tvm/relay/transform/fake_quantization_to_integer.py:
##########
@@ -502,6 +502,33 @@ def register_binary_qnn(op_name, op):
 
     def binary(expr, type_map):
         left, right, left_t, right_t, out_t = get_binary_types(expr, type_map)
+
+        if (
+            approx_equal(left_t.scale, right_t.scale)

Review Comment:
   `out_t.scale` and `out_t.zero_point` can be of shape `(channels,)` if the 
addition is used as bias add. If I comment out this if statement and run the 
test attached in this PR, I get
   
   `AssertionError: The output scale needs to be a scalar, but got a tensor of 
shape (256,)` 
   
   from the assert I added.
   
   I think there is something weird in the implementation of FQ2I, since it 
doesn't make sense to have an output scale of shape `(channels,)`.  But that's 
how it works now, so this is the workaround I came up with.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to