From 0420fb2292a3c8651aed06dd5216bd79897e329e Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Tue, 14 Jan 2025 13:54:12 +0100 Subject: [PATCH] Update random tests --- .../third_party/cupy/random_tests/test_permutations.py | 2 +- dpnp/tests/third_party/cupy/random_tests/test_sample.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dpnp/tests/third_party/cupy/random_tests/test_permutations.py b/dpnp/tests/third_party/cupy/random_tests/test_permutations.py index eed47320e51..e703856728a 100644 --- a/dpnp/tests/third_party/cupy/random_tests/test_permutations.py +++ b/dpnp/tests/third_party/cupy/random_tests/test_permutations.py @@ -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 diff --git a/dpnp/tests/third_party/cupy/random_tests/test_sample.py b/dpnp/tests/third_party/cupy/random_tests/test_sample.py index 703385c3769..0507e11763c 100644 --- a/dpnp/tests/third_party/cupy/random_tests/test_sample.py +++ b/dpnp/tests/third_party/cupy/random_tests/test_sample.py @@ -89,7 +89,7 @@ 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) @@ -97,7 +97,7 @@ def test_goodness_of_fit(self): @_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) @@ -191,7 +191,7 @@ 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) @@ -199,7 +199,7 @@ def test_goodness_of_fit(self): @_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)