Skip to content

Commit 2e07447

Browse files
tqchenyzhliu
authored andcommitted
[TOPI] Fix flaky testcase for check round (#4211)
1 parent 780a994 commit 2e07447

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

topi/tests/python/test_topi_math.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def test_apply(
5252
a_np = np.random.uniform(low=low, high=high, size=shape).astype(A.dtype) * 10
5353
# avoid round check too close to boundary
5454
if check_round:
55-
a_np += ((np.fmod(a_np, 1) - 0.5) < 1e-6) * 1e-5
55+
a_np += ((np.abs(np.fmod(a_np, 1)) - 0.5) < 1e-6) * 1e-5
5656
b_np = f_numpy(a_np)
5757

5858
def check_device(device):
@@ -100,7 +100,7 @@ def test_isnan(
100100
a_np.ravel()[np.random.choice(a_np.size, int(a_np.size * 0.5), replace=False)] = np.nan
101101
# avoid round check too close to boundary
102102
if check_round:
103-
a_np += ((np.fmod(a_np, 1) - 0.5) < 1e-6) * 1e-5
103+
a_np += ((np.abs(np.fmod(a_np, 1)) - 0.5) < 1e-6) * 1e-5
104104
b_np = np.isnan(a_np)
105105

106106
def check_device(device):

0 commit comments

Comments
 (0)