From b1a638f3071c6363c33082a7e181d07fed4c48a9 Mon Sep 17 00:00:00 2001 From: Kenneth Heafield Date: Mon, 21 Sep 2020 16:43:44 +0000 Subject: [PATCH] Fix flaky intgemm test in v1.8.x too --- 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 69fa5e0eefda..fff531e42d86 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)