jackwish commented on a change in pull request #4798: [QNN] Optimize lowering
for requantize and FixedPointMultiply.
URL: https://github.com/apache/incubator-tvm/pull/4798#discussion_r373816675
##########
File path: src/relay/qnn/op/requantize.cc
##########
@@ -103,7 +103,11 @@ Expr RequantizeLower(const Expr& input_tensor, const
Expr& input_scale,
shifted_int64_t = Add(Cast(output_zero_point, hp_dtype), scaled_int64_t);
}
- // 4) Clip to the out_dtype min/max.
+ // 4) Clip to the out_dtype min/max. Skip clipping if out_dtype is Int32.
The fixed point
+ // multiplication keeps the value in int32 range.
+ if (out_dtype == DataType::Int(32)) {
+ return Cast(shifted_int64_t, out_dtype);
+ }
Review comment:
Would you please share the insight here? I looked around, but lost a bit in
the arithmetic here. :)
----------------------------------------------------------------
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