@@ -89,15 +89,15 @@ def test_bound_float2(self):
89
89
def test_goodness_of_fit (self ):
90
90
mx = 5
91
91
trial = 100
92
- vals = [random .randint (mx ) for _ in range (trial )]
92
+ vals = [random .randint (mx ). asnumpy () for _ in range (trial )]
93
93
counts = numpy .histogram (vals , bins = numpy .arange (mx + 1 ))[0 ]
94
94
expected = numpy .array ([float (trial ) / mx ] * mx )
95
95
assert _hypothesis .chi_square_test (counts , expected )
96
96
97
97
@_condition .repeat (3 , 10 )
98
98
def test_goodness_of_fit_2 (self ):
99
99
mx = 5
100
- vals = random .randint (mx , size = (5 , 20 ))
100
+ vals = random .randint (mx , size = (5 , 20 )). asnumpy ()
101
101
counts = numpy .histogram (vals , bins = numpy .arange (mx + 1 ))[0 ]
102
102
expected = numpy .array ([float (vals .size ) / mx ] * mx )
103
103
assert _hypothesis .chi_square_test (counts , expected )
@@ -191,15 +191,15 @@ def test_bound_2(self):
191
191
def test_goodness_of_fit (self ):
192
192
mx = 5
193
193
trial = 100
194
- vals = [random .randint (0 , mx ) for _ in range (trial )]
194
+ vals = [random .randint (0 , mx ). asnumpy () for _ in range (trial )]
195
195
counts = numpy .histogram (vals , bins = numpy .arange (mx + 1 ))[0 ]
196
196
expected = numpy .array ([float (trial ) / mx ] * mx )
197
197
assert _hypothesis .chi_square_test (counts , expected )
198
198
199
199
@_condition .repeat (3 , 10 )
200
200
def test_goodness_of_fit_2 (self ):
201
201
mx = 5
202
- vals = random .randint (0 , mx , (5 , 20 ))
202
+ vals = random .randint (0 , mx , (5 , 20 )). asnumpy ()
203
203
counts = numpy .histogram (vals , bins = numpy .arange (mx + 1 ))[0 ]
204
204
expected = numpy .array ([float (vals .size ) / mx ] * mx )
205
205
assert _hypothesis .chi_square_test (counts , expected )
0 commit comments