MCPcopy Create free account
hub / github.com/dask/dask / test_random_shapes

Function test_random_shapes

dask/array/tests/test_cupy_random.py:202–217  ·  view source on GitHub ↗
(shape)

Source from the content-addressed store, hash-verified

200
201@pytest.mark.parametrize("shape", [(2, 3), (2, 3, 4), (2, 3, 4, 2)])
202def test_random_shapes(shape):
203 rs = da.random.RandomState(RandomState=cupy.random.RandomState)
204
205 x = rs.poisson(size=shape, chunks=3)
206 assert type(x._meta) == cupy.ndarray
207 assert_eq(x, x) # Check that _meta and computed arrays match types
208 assert x._meta.shape == (0,) * len(shape)
209 assert x.shape == shape
210
211 rng = da.random.default_rng(cupy.random.default_rng())
212
213 x = rng.poisson(1.0, size=shape, chunks=3)
214 assert type(x._meta) == cupy.ndarray
215 assert_eq(x, x) # Check that _meta and computed arrays match types
216 assert x._meta.shape == (0,) * len(shape)
217 assert x.shape == shape

Callers

nothing calls this directly

Calls 4

poissonMethod · 0.95
assert_eqFunction · 0.90
RandomStateMethod · 0.45
poissonMethod · 0.45

Tested by

no test coverage detected