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

[BUGFIX] Fix flaky test #19197 by avoiding case that 0.45 mapped to 0.5 #19201

Merged
merged 1 commit into from
Sep 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/python/unittest/test_contrib_intgemm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down