Skip to content

Commit 58c7de5

Browse files
committed
Use generate_random_numpy_array in test_strided per review comment
1 parent 1dd0469 commit 58c7de5

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

dpnp/tests/test_linalg.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,6 @@ def test_cholesky_errors(self):
280280
class TestCond:
281281
_norms = [None, -dpnp.inf, -2, -1, 1, 2, dpnp.inf, "fro"]
282282

283-
def setup_method(self):
284-
numpy.random.seed(70)
285-
286283
@pytest.mark.parametrize(
287284
"shape", [(0, 4, 4), (4, 0, 3, 3)], ids=["(0, 4, 4)", "(4, 0, 3, 3)"]
288285
)
@@ -354,13 +351,12 @@ def test_nan_to_inf(self, p):
354351
],
355352
)
356353
def test_strided(self, p, stride):
357-
A = numpy.random.rand(6, 8, 10, 10)
358-
B = dpnp.asarray(A)
354+
A = generate_random_numpy_array((6, 8, 10, 10))
355+
iA = dpnp.array(A)
359356
slices = tuple(slice(None, None, stride[i]) for i in range(A.ndim))
360-
a = A[slices]
361-
b = B[slices]
357+
a, ia = A[slices], iA[slices]
362358

363-
result = dpnp.linalg.cond(b, p=p)
359+
result = dpnp.linalg.cond(ia, p=p)
364360
expected = numpy.linalg.cond(a, p=p)
365361
assert_dtype_allclose(result, expected, factor=24)
366362

0 commit comments

Comments
 (0)