Skip to content

Commit 56fea1e

Browse files
Make test more stable by adjusting tolerance
1 parent 05907b1 commit 56fea1e

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

dpnp/tests/test_linalg.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,10 +2182,7 @@ def test_lu_solve(self, shape, rhs_cols, order, dtype):
21822182

21832183
# check A @ x = b
21842184
Ax = a_dp @ x
2185-
if dpnp.issubdtype(dtype, dpnp.integer):
2186-
assert dpnp.allclose(Ax, b_dp, rtol=1e-5, atol=1e-5)
2187-
else:
2188-
assert dpnp.allclose(Ax, b_dp, rtol=1e-6, atol=1e-6)
2185+
assert dpnp.allclose(Ax, b_dp, rtol=1e-5, atol=1e-5)
21892186

21902187
@pytest.mark.parametrize("trans", [0, 1, 2])
21912188
@pytest.mark.parametrize("dtype", get_float_complex_dtypes())
@@ -2207,7 +2204,7 @@ def test_trans(self, trans, dtype):
22072204
else: # trans == 2
22082205
lhs = a_dp.conj().T @ x
22092206

2210-
assert dpnp.allclose(lhs, b_dp, rtol=1e-6, atol=1e-6)
2207+
assert dpnp.allclose(lhs, b_dp, rtol=1e-5, atol=1e-5)
22112208

22122209
@pytest.mark.parametrize("dtype", get_float_complex_dtypes())
22132210
def test_overwrite_inplace(self, dtype):
@@ -2272,7 +2269,7 @@ def test_diff_type(self, dtype_a, dtype_b):
22722269
lu, piv = dpnp.linalg.lu_factor(a_dp, check_finite=False)
22732270
x = dpnp.linalg.lu_solve((lu, piv), b_dp, check_finite=False)
22742271
assert dpnp.allclose(
2275-
a_dp @ x, b_dp.astype(x.dtype, copy=False), rtol=1e-6, atol=1e-6
2272+
a_dp @ x, b_dp.astype(x.dtype, copy=False), rtol=1e-5, atol=1e-5
22762273
)
22772274

22782275
def test_strided_rhs(self):
@@ -2295,7 +2292,7 @@ def test_strided_rhs(self):
22952292
(lu, piv), b_dp, overwrite_b=False, check_finite=False
22962293
)
22972294

2298-
assert dpnp.allclose(a_dp @ x, b_dp, rtol=1e-6, atol=1e-6)
2295+
assert dpnp.allclose(a_dp @ x, b_dp, rtol=1e-5, atol=1e-5)
22992296

23002297
@pytest.mark.parametrize(
23012298
"b_shape",
@@ -2324,7 +2321,7 @@ def test_broadcast_rhs(self, b_shape):
23242321

23252322
assert x.shape == b_dp.shape
23262323

2327-
assert dpnp.allclose(a_dp @ x, b_dp, rtol=1e-6, atol=1e-6)
2324+
assert dpnp.allclose(a_dp @ x, b_dp, rtol=1e-5, atol=1e-5)
23282325

23292326
@pytest.mark.parametrize("shape", [(0, 0), (0, 5), (5, 5)])
23302327
@pytest.mark.parametrize("rhs_cols", [None, 0, 3])

0 commit comments

Comments
 (0)