From: abergeron Date: Fri, 5 Jun 2020 21:17:41 +0000 (-0400) Subject: Fix the values for test_fmod since it fails way too often otherwise (#5723) X-Git-Tag: upstream/0.7.0~603 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=de547544807afc50a9d2b88d822d8b0f80c0f524;p=platform%2Fupstream%2Ftvm.git Fix the values for test_fmod since it fails way too often otherwise (#5723) --- 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