Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Fix flaky tests for quantize and requantize (#12040)
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyu-intel authored and marcoabreu committed Aug 10, 2018
1 parent 7e99621 commit f6215b1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tests/python/quantization/test_quantization.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_quantize_float32_to_int8():
assert same(min_val.asscalar(), -real_range)
assert same(max_val.asscalar(), real_range)
qdata_np = (np.sign(data_np) * np.minimum(np.abs(data_np) * scale + 0.5, quantized_range)).astype(np.int8)
assert same(qdata.asnumpy(), qdata_np)
assert_almost_equal(qdata.asnumpy(), qdata_np, atol = 1)


@with_seed()
Expand All @@ -77,7 +77,6 @@ def test_dequantize_int8_to_float32():


@with_seed()
@unittest.skip('Flaky test, tracked in: https://github.com/apache/incubator-mxnet/issues/11747')
def test_requantize_int32_to_int8():
def quantized_int32_to_float(qdata, min_range, max_range):
assert qdata.dtype == 'int32'
Expand Down Expand Up @@ -121,7 +120,7 @@ def check_requantize(shape, min_calib_range=None, max_calib_range=None):
max_range.asscalar(),
min_calib_range=min_calib_range,
max_calib_range=max_calib_range)
assert_almost_equal(qdata_int8.asnumpy(), qdata_int8_np)
assert_almost_equal(qdata_int8.asnumpy(), qdata_int8_np, atol = 1)
assert_almost_equal(min_output.asnumpy(), np.array([min_output_np]))
assert_almost_equal(max_output.asnumpy(), np.array([max_output_np]))

Expand Down

0 comments on commit f6215b1

Please sign in to comment.