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 2022/04/04 16:57:54 UTC

[GitHub] [tvm] AndrewZhaoLuo commented on a diff in pull request #10880: [QNN] Fix qnn.dequantize scale and zp shape

AndrewZhaoLuo commented on code in PR #10880:
URL: https://github.com/apache/tvm/pull/10880#discussion_r841956651


##########
src/relay/qnn/op/dequantize.cc:
##########
@@ -65,8 +65,9 @@ bool DequantizeRel(const Array<Type>& types, int num_inputs, const Attrs& attrs,
     ICHECK_GE(axis, 0) << "axis " << dequantize_attrs->axis << " is out of range";
   }
 
+  // We assume per-channel dequantization if rank > 1, otherwise it's per tensor.
   PrimExpr axis_shape;
-  if (rank > 0) {
+  if ((!(scale_is_scalar && zp_is_scalar)) && (rank > 1)) {

Review Comment:
   Hmm I believe we can still have per channel quantization if rank == 1. In this case it would just be every element has it's own set of quantization params. 
   
   I think the proper check is to change `*_is_scalar` variables to see if either the rank of `scale` or `zp` is either of rank 0, or of arbitrary rank but with one element.



-- 
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: commits-unsubscribe@tvm.apache.org

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