@@ -888,7 +888,7 @@ def test_order(self, dtype, order1, order2, order, shape1, shape2):
888888 def test_strided1 (self , dtype , stride ):
889889 for dim in [1 , 2 , 3 , 4 ]:
890890 shape = tuple (20 for _ in range (dim ))
891- A = numpy . random . rand ( * shape ). astype ( dtype )
891+ A = generate_random_numpy_array ( shape , dtype )
892892 iA = dpnp .array (A )
893893 slices = tuple (slice (None , None , stride [i ]) for i in range (dim ))
894894 a = A [slices ]
@@ -897,13 +897,13 @@ def test_strided1(self, dtype, stride):
897897 # the 2D base is not c-contiguous nor f-contigous
898898 result = dpnp .matmul (ia , ia )
899899 expected = numpy .matmul (a , a )
900- assert_dtype_allclose (result , expected )
900+ assert_dtype_allclose (result , expected , factor = 16 )
901901
902902 iOUT = dpnp .empty (shape , dtype = result .dtype )
903903 iout = iOUT [slices ]
904904 result = dpnp .matmul (ia , ia , out = iout )
905905 assert result is iout
906- assert_dtype_allclose (result , expected )
906+ assert_dtype_allclose (result , expected , factor = 16 )
907907
908908 @pytest .mark .parametrize ("dtype" , _selected_dtypes )
909909 @pytest .mark .parametrize (
@@ -915,7 +915,7 @@ def test_strided2(self, dtype, shape, stride, transpose):
915915 # one dimension (axis=-3) is strided
916916 # if negative stride, copy is needed and the base becomes c-contiguous
917917 # otherwise the base remains the same as input in gemm_batch
918- A = numpy . random . rand ( * shape ). astype ( dtype )
918+ A = generate_random_numpy_array ( shape , dtype )
919919 iA = dpnp .array (A )
920920 if transpose :
921921 A = numpy .moveaxis (A , (- 2 , - 1 ), (- 1 , - 2 ))
@@ -948,7 +948,7 @@ def test_strided3(self, dtype, stride, transpose):
948948 # For positive stride, no copy but reshape makes the base c-contiguous.
949949 stride0 , stride1 = stride
950950 shape = (12 , 10 , 3 , 3 ) # 4D array
951- A = numpy . random . rand ( * shape ). astype ( dtype )
951+ A = generate_random_numpy_array ( shape , dtype )
952952 iA = dpnp .array (A )
953953 if transpose :
954954 A = numpy .moveaxis (A , (- 2 , - 1 ), (- 1 , - 2 ))
@@ -980,7 +980,7 @@ def test_strided_mat_vec(self, dtype, func, incx, incy, transpose):
980980 else :
981981 s1 = shape [- 1 ]
982982 s2 = shape [- 2 ]
983- a = numpy . random . rand ( * shape ). astype ( dtype )
983+ a = generate_random_numpy_array ( shape , dtype )
984984 ia = dpnp .array (a )
985985 if transpose :
986986 a = numpy .moveaxis (a , (- 2 , - 1 ), (- 1 , - 2 ))
@@ -1016,7 +1016,7 @@ def test_strided_vec_mat(self, dtype, func, incx, incy, transpose):
10161016 else :
10171017 s1 = shape [- 1 ]
10181018 s2 = shape [- 2 ]
1019- a = numpy . random . rand ( * shape ). astype ( dtype )
1019+ a = generate_random_numpy_array ( shape , dtype )
10201020 ia = dpnp .array (a )
10211021 if transpose :
10221022 a = numpy .moveaxis (a , (- 2 , - 1 ), (- 1 , - 2 ))
0 commit comments