From 28b0fc4918905fe6ebedb1992a75193d5c64b24d Mon Sep 17 00:00:00 2001 From: tqchen Date: Mon, 28 Oct 2019 11:17:46 -0400 Subject: [PATCH] [TOPI] Fix flaky testcase for check round --- topi/tests/python/test_topi_math.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/topi/tests/python/test_topi_math.py b/topi/tests/python/test_topi_math.py index ebbf6f7bd3d6..bb674364ff2e 100644 --- a/topi/tests/python/test_topi_math.py +++ b/topi/tests/python/test_topi_math.py @@ -52,7 +52,7 @@ def test_apply( a_np = np.random.uniform(low=low, high=high, size=shape).astype(A.dtype) * 10 # avoid round check too close to boundary if check_round: - a_np += ((np.fmod(a_np, 1) - 0.5) < 1e-6) * 1e-5 + a_np += ((np.abs(np.fmod(a_np, 1)) - 0.5) < 1e-6) * 1e-5 b_np = f_numpy(a_np) def check_device(device): @@ -100,7 +100,7 @@ def test_isnan( a_np.ravel()[np.random.choice(a_np.size, int(a_np.size * 0.5), replace=False)] = np.nan # avoid round check too close to boundary if check_round: - a_np += ((np.fmod(a_np, 1) - 0.5) < 1e-6) * 1e-5 + a_np += ((np.abs(np.fmod(a_np, 1)) - 0.5) < 1e-6) * 1e-5 b_np = np.isnan(a_np) def check_device(device):