Skip to content

Commit

Permalink
Update random tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antonwolfy committed Jan 14, 2025
1 parent d79dcb0 commit 0420fb2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class TestPermutationSoundness(unittest.TestCase):

def setUp(self):
a = cupy.random.permutation(self.num)
self.a = a
self.a = a.asnumpy()

# Test soundness

Expand Down
8 changes: 4 additions & 4 deletions dpnp/tests/third_party/cupy/random_tests/test_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ def test_bound_float2(self):
def test_goodness_of_fit(self):
mx = 5
trial = 100
vals = [random.randint(mx) for _ in range(trial)]
vals = [random.randint(mx).asnumpy() for _ in range(trial)]
counts = numpy.histogram(vals, bins=numpy.arange(mx + 1))[0]
expected = numpy.array([float(trial) / mx] * mx)
assert _hypothesis.chi_square_test(counts, expected)

@_condition.repeat(3, 10)
def test_goodness_of_fit_2(self):
mx = 5
vals = random.randint(mx, size=(5, 20))
vals = random.randint(mx, size=(5, 20)).asnumpy()
counts = numpy.histogram(vals, bins=numpy.arange(mx + 1))[0]
expected = numpy.array([float(vals.size) / mx] * mx)
assert _hypothesis.chi_square_test(counts, expected)
Expand Down Expand Up @@ -191,15 +191,15 @@ def test_bound_2(self):
def test_goodness_of_fit(self):
mx = 5
trial = 100
vals = [random.randint(0, mx) for _ in range(trial)]
vals = [random.randint(0, mx).asnumpy() for _ in range(trial)]
counts = numpy.histogram(vals, bins=numpy.arange(mx + 1))[0]
expected = numpy.array([float(trial) / mx] * mx)
assert _hypothesis.chi_square_test(counts, expected)

@_condition.repeat(3, 10)
def test_goodness_of_fit_2(self):
mx = 5
vals = random.randint(0, mx, (5, 20))
vals = random.randint(0, mx, (5, 20)).asnumpy()
counts = numpy.histogram(vals, bins=numpy.arange(mx + 1))[0]
expected = numpy.array([float(vals.size) / mx] * mx)
assert _hypothesis.chi_square_test(counts, expected)
Expand Down

0 comments on commit 0420fb2

Please sign in to comment.