@@ -35,16 +35,8 @@ def get_default_floating():
35
35
36
36
37
37
class TestNormal :
38
- @pytest .mark .parametrize (
39
- "dtype" ,
40
- [dpnp .float32 , dpnp .float64 , None ],
41
- ids = ["float32" , "float64" , "None" ],
42
- )
43
- @pytest .mark .parametrize (
44
- "usm_type" ,
45
- ["host" , "device" , "shared" ],
46
- ids = ["host" , "device" , "shared" ],
47
- )
38
+ @pytest .mark .parametrize ("dtype" , [dpnp .float32 , dpnp .float64 , None ])
39
+ @pytest .mark .parametrize ("usm_type" , ["host" , "device" , "shared" ])
48
40
def test_distr (self , dtype , usm_type ):
49
41
seed = 1234567
50
42
sycl_queue = dpctl .SyclQueue ()
@@ -98,16 +90,8 @@ def test_distr(self, dtype, usm_type):
98
90
# check if compute follows data isn't broken
99
91
assert_cfd (dpnp_data , sycl_queue , usm_type )
100
92
101
- @pytest .mark .parametrize (
102
- "dtype" ,
103
- [dpnp .float32 , dpnp .float64 , None ],
104
- ids = ["float32" , "float64" , "None" ],
105
- )
106
- @pytest .mark .parametrize (
107
- "usm_type" ,
108
- ["host" , "device" , "shared" ],
109
- ids = ["host" , "device" , "shared" ],
110
- )
93
+ @pytest .mark .parametrize ("dtype" , [dpnp .float32 , dpnp .float64 , None ])
94
+ @pytest .mark .parametrize ("usm_type" , ["host" , "device" , "shared" ])
111
95
def test_scale (self , dtype , usm_type ):
112
96
mean = 7
113
97
rs = RandomState (39567 )
@@ -150,14 +134,12 @@ def test_inf_loc(self, loc):
150
134
151
135
def test_inf_scale (self ):
152
136
a = RandomState ().normal (0 , numpy .inf , size = 1000 )
153
- assert_equal ( dpnp .isnan (a ).any (), False )
154
- assert_equal ( dpnp .isinf (a ).all (), True )
137
+ assert not dpnp .isnan (a ).any ()
138
+ assert dpnp .isinf (a ).all ()
155
139
assert_equal (a .max (), numpy .inf )
156
140
assert_equal (a .min (), - numpy .inf )
157
141
158
- @pytest .mark .parametrize (
159
- "loc" , [numpy .inf , - numpy .inf ], ids = ["numpy.inf" , "-numpy.inf" ]
160
- )
142
+ @pytest .mark .parametrize ("loc" , [numpy .inf , - numpy .inf ])
161
143
def test_inf_loc_scale (self , loc ):
162
144
a = RandomState ().normal (loc = loc , scale = numpy .inf , size = 1000 )
163
145
assert_equal (dpnp .isnan (a ).all (), False )
@@ -270,11 +252,7 @@ def test_invalid_usm_type(self, usm_type):
270
252
271
253
272
254
class TestRand :
273
- @pytest .mark .parametrize (
274
- "usm_type" ,
275
- ["host" , "device" , "shared" ],
276
- ids = ["host" , "device" , "shared" ],
277
- )
255
+ @pytest .mark .parametrize ("usm_type" , ["host" , "device" , "shared" ])
278
256
def test_distr (self , usm_type ):
279
257
seed = 28042
280
258
sycl_queue = dpctl .SyclQueue ()
@@ -359,11 +337,7 @@ class TestRandInt:
359
337
[int , dpnp .int32 , dpnp .int_ ],
360
338
ids = ["int" , "dpnp.int32" , "dpnp.int_" ],
361
339
)
362
- @pytest .mark .parametrize (
363
- "usm_type" ,
364
- ["host" , "device" , "shared" ],
365
- ids = ["host" , "device" , "shared" ],
366
- )
340
+ @pytest .mark .parametrize ("usm_type" , ["host" , "device" , "shared" ])
367
341
def test_distr (self , dtype , usm_type ):
368
342
seed = 9864
369
343
low = 1
@@ -593,11 +567,7 @@ def test_invalid_usm_type(self, usm_type):
593
567
594
568
595
569
class TestRandN :
596
- @pytest .mark .parametrize (
597
- "usm_type" ,
598
- ["host" , "device" , "shared" ],
599
- ids = ["host" , "device" , "shared" ],
600
- )
570
+ @pytest .mark .parametrize ("usm_type" , ["host" , "device" , "shared" ])
601
571
def test_distr (self , usm_type ):
602
572
seed = 3649
603
573
sycl_queue = dpctl .SyclQueue ()
@@ -627,6 +597,7 @@ def test_distr(self, usm_type):
627
597
628
598
# TODO: discuss with oneMKL: there is a difference between CPU and GPU
629
599
# generated samples since 9 digit while precision=15 for float64
600
+ # precision = dpnp.finfo(numpy.float64).precision
630
601
precision = dpnp .finfo (numpy .float32 ).precision
631
602
assert_array_almost_equal (data , expected , decimal = precision )
632
603
@@ -677,9 +648,7 @@ def test_wrong_dims(self):
677
648
678
649
class TestSeed :
679
650
@pytest .mark .parametrize (
680
- "func" ,
681
- ["normal" , "standard_normal" , "random_sample" , "uniform" ],
682
- ids = ["normal" , "standard_normal" , "random_sample" , "uniform" ],
651
+ "func" , ["normal" , "standard_normal" , "random_sample" , "uniform" ]
683
652
)
684
653
def test_scalar (self , func ):
685
654
seed = 28041997
@@ -827,11 +796,7 @@ def test_invalid_shape(self, seed):
827
796
828
797
829
798
class TestStandardNormal :
830
- @pytest .mark .parametrize (
831
- "usm_type" ,
832
- ["host" , "device" , "shared" ],
833
- ids = ["host" , "device" , "shared" ],
834
- )
799
+ @pytest .mark .parametrize ("usm_type" , ["host" , "device" , "shared" ])
835
800
def test_distr (self , usm_type ):
836
801
seed = 1234567
837
802
sycl_queue = dpctl .SyclQueue ()
@@ -905,11 +870,7 @@ def test_wrong_dims(self):
905
870
906
871
907
872
class TestRandSample :
908
- @pytest .mark .parametrize (
909
- "usm_type" ,
910
- ["host" , "device" , "shared" ],
911
- ids = ["host" , "device" , "shared" ],
912
- )
873
+ @pytest .mark .parametrize ("usm_type" , ["host" , "device" , "shared" ])
913
874
def test_distr (self , usm_type ):
914
875
seed = 12657
915
876
sycl_queue = dpctl .SyclQueue ()
@@ -981,15 +942,9 @@ class TestUniform:
981
942
ids = ["(low, high)=[1.23, 10.54]" , "(low, high)=[10.54, 1.23]" ],
982
943
)
983
944
@pytest .mark .parametrize (
984
- "dtype" ,
985
- [dpnp .float32 , dpnp .float64 , dpnp .int32 , None ],
986
- ids = ["float32" , "float64" , "int32" , "None" ],
987
- )
988
- @pytest .mark .parametrize (
989
- "usm_type" ,
990
- ["host" , "device" , "shared" ],
991
- ids = ["host" , "device" , "shared" ],
945
+ "dtype" , [dpnp .float32 , dpnp .float64 , dpnp .int32 , None ]
992
946
)
947
+ @pytest .mark .parametrize ("usm_type" , ["host" , "device" , "shared" ])
993
948
def test_distr (self , bounds , dtype , usm_type ):
994
949
seed = 28041997
995
950
low = bounds [0 ]
@@ -1043,15 +998,9 @@ def test_distr(self, bounds, dtype, usm_type):
1043
998
assert_cfd (actual , sycl_queue , usm_type )
1044
999
1045
1000
@pytest .mark .parametrize (
1046
- "dtype" ,
1047
- [dpnp .float32 , dpnp .float64 , dpnp .int32 , None ],
1048
- ids = ["float32" , "float64" , "int32" , "None" ],
1049
- )
1050
- @pytest .mark .parametrize (
1051
- "usm_type" ,
1052
- ["host" , "device" , "shared" ],
1053
- ids = ["host" , "device" , "shared" ],
1001
+ "dtype" , [dpnp .float32 , dpnp .float64 , dpnp .int32 , None ]
1054
1002
)
1003
+ @pytest .mark .parametrize ("usm_type" , ["host" , "device" , "shared" ])
1055
1004
def test_low_high_equal (self , dtype , usm_type ):
1056
1005
seed = 28045
1057
1006
low = high = 3.75
0 commit comments