ZhennanQin commented on a change in pull request #14150: Fix entropy for uint8
URL: https://github.com/apache/incubator-mxnet/pull/14150#discussion_r265822787
##########
File path: tests/python/quantization/test_quantization.py
##########
@@ -673,8 +673,9 @@ def test_optimal_threshold_adversarial_case():
# The worst case for the optimal_threshold function is when the values are
concentrated
# at one edge: [0, 0, ..., 1000]. (histogram)
# We want to make sure that the optimal threshold in this case is the max.
- arr = np.array([2]*1000)
- res = mx.contrib.quant._get_optimal_threshold(arr, num_quantized_bins=5)
+ arr = np.array([2] * 1000)
+ for dtype in ['uint8', 'int8', 'auto']:
+ res = mx.contrib.quant._get_optimal_threshold(arr, dtype,
num_quantized_bins=5)
# The threshold should be 2.
assert res[3] - 2 < 1e-5
Review comment:
Done.
----------------------------------------------------------------
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