This is an automated email from the ASF dual-hosted git repository.

samskalicky pushed a commit to branch v1.x
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/v1.x by this push:
     new 4e46b51  Fix flaky test #19197 by avoiding case that 0.45 mapped to 
0.5 (#19201)
4e46b51 is described below

commit 4e46b518ada8f405029ff0a215bbcf53e560543c
Author: kpuatamazon <[email protected]>
AuthorDate: Mon Sep 21 21:13:17 2020 +0100

    Fix flaky test #19197 by avoiding case that 0.45 mapped to 0.5 (#19201)
---
 tests/python/unittest/test_contrib_intgemm.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/python/unittest/test_contrib_intgemm.py 
b/tests/python/unittest/test_contrib_intgemm.py
index 69fa5e0..fff531e 100644
--- a/tests/python/unittest/test_contrib_intgemm.py
+++ b/tests/python/unittest/test_contrib_intgemm.py
@@ -53,7 +53,8 @@ def test_contrib_intgemm_prepare_data():
         scaled = m * 127.0 / max_quant
         # Rounding 0.5 can go up or down.  Move values away from 0.5.
         too_close = mx.nd.abs(mx.nd.round(scaled) - scaled) > 0.45
-        m += max_quant / 127.0 * 0.05 * too_close
+        # Add 0.2 in scaled space so (0.45, 0.55) maps to (0.65, 0.75) which 
will round consistently.
+        m += max_quant / 127.0 * 0.2 * too_close
     
         # Reference: scale and round
         ref = mx.nd.round(m * 127.0 / max_quant)

Reply via email to