Skip to content

Commit 1ec95dd

Browse files
committed
OneMKL 2023.1 includes fix gaussian() with box_muller2 method
1 parent 2dfa804 commit 1ec95dd

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tests/test_random_state.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,9 @@ def test_distr(self, usm_type):
473473
data = RandomState(seed, sycl_queue=sycl_queue).randn(3, 2, usm_type=usm_type)
474474
assert_array_almost_equal(data.asnumpy(), desired, decimal=precision)
475475

476-
# TODO: discuss with oneMKL: return 0.0 instead of the 1st element
477476
# call with omitted dimensions has to draw the first element from desired
478-
# actual = dpnp.asnumpy(RandomState(seed).randn(usm_type=usm_type))
479-
# assert_array_almost_equal(actual, desired[0, 0], decimal=precision)
477+
actual = dpnp.asnumpy(RandomState(seed).randn(usm_type=usm_type))
478+
assert_array_almost_equal(actual, desired[0, 0], decimal=precision)
480479

481480
# randn() is an alias on standard_normal(), map arguments
482481
with mock.patch('dpnp.random.RandomState.standard_normal') as m:
@@ -622,10 +621,13 @@ def test_distr(self, usm_type):
622621
precision = numpy.finfo(dtype=numpy.float32).precision
623622
assert_array_almost_equal(data.asnumpy(), desired, decimal=precision)
624623

625-
# TODO: discuss with oneMKL: return 0.0 instead of the 1st element
624+
# call with the same seed has to draw the same values
625+
data = RandomState(seed, sycl_queue=sycl_queue).standard_normal(size=(4, 2), usm_type=usm_type)
626+
assert_array_almost_equal(data.asnumpy(), desired, decimal=precision)
627+
626628
# call with omitted dimensions has to draw the first element from desired
627-
# actual = dpnp.asnumpy(RandomState(seed).standard_normal(usm_type=usm_type))
628-
# assert_array_almost_equal(actual, desired[0, 0], decimal=precision)
629+
actual = dpnp.asnumpy(RandomState(seed).standard_normal(usm_type=usm_type))
630+
assert_array_almost_equal(actual, desired[0, 0], decimal=precision)
629631

630632
# random_sample() is an alias on uniform(), map arguments
631633
with mock.patch('dpnp.random.RandomState.normal') as m:

0 commit comments

Comments
 (0)