From de547544807afc50a9d2b88d822d8b0f80c0f524 Mon Sep 17 00:00:00 2001 From: abergeron Date: Fri, 5 Jun 2020 17:17:41 -0400 Subject: [PATCH] Fix the values for test_fmod since it fails way too often otherwise (#5723) --- tests/python/integration/test_ewise.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/python/integration/test_ewise.py b/tests/python/integration/test_ewise.py index a8f2db1..dfa247e 100644 --- a/tests/python/integration/test_ewise.py +++ b/tests/python/integration/test_ewise.py @@ -80,8 +80,15 @@ def test_fmod(): # launch the kernel. n = 1024 - a = tvm.nd.array((np.random.uniform(size=n) * 256).astype(A.dtype), ctx) - b = tvm.nd.array((np.random.uniform(size=n) * 256).astype(B.dtype), ctx) + a_np = (np.random.uniform(size=n) * 256).astype(A.dtype) + b_np = (np.random.uniform(size=n) * 256).astype(B.dtype) + + # "fix" the values in a and b to avoid the result being too small + b_np += ((b_np < 2.0) * 2) + a_np[np.abs(np.fmod(a_np, b_np)) < 1] += 1 + + a = tvm.nd.array(a_np, ctx) + b = tvm.nd.array(b_np, ctx) c = tvm.nd.array(np.zeros(n, dtype=C.dtype), ctx) ftimer = fmod.time_evaluator(fmod.entry_name, ctx, number=1) tcost = ftimer(a, b, c).mean -- 2.7.4