tlopex commented on issue #15148:
URL: https://github.com/apache/tvm/issues/15148#issuecomment-1739727222
@p3achyjr
``` # calculate the mean and quantization scale for every input
tensor,
# with respect to its fp32 input range, defined in fake_quant.
# s = 255/(fmax-fmin); m = -fmin*s (the zero point)
for i in input_arrays:
try:
quant_scale = 255 / (input_range[i][1] -
input_range[i][0])
except ZeroDivisionError:
print("Min and max of the input range for tensor " + i +
" can't be equal")
mean = -input_range[i][0] * quant_scale
input_stats[i] = (mean, quant_scale)```
Here, if the range is symmetrical, the zero point will always be 128.
--
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]