MCPcopy Index your code
hub / github.com/dask/dask / test_broadcast_to_chunks

Function test_broadcast_to_chunks

dask/array/tests/test_array_core.py:1380–1399  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1378
1379
1380def test_broadcast_to_chunks():
1381 x = np.random.default_rng().integers(10, size=(5, 1, 6))
1382 a = from_array(x, chunks=(3, 1, 3))
1383
1384 for shape, chunks, expected_chunks in [
1385 ((5, 3, 6), (3, -1, 3), ((3, 2), (3,), (3, 3))),
1386 ((5, 3, 6), (3, 1, 3), ((3, 2), (1, 1, 1), (3, 3))),
1387 ((2, 5, 3, 6), (1, 3, 1, 3), ((1, 1), (3, 2), (1, 1, 1), (3, 3))),
1388 ]:
1389 xb = np.broadcast_to(x, shape)
1390 ab = broadcast_to(a, shape, chunks=chunks)
1391 assert_eq(xb, ab)
1392 assert ab.chunks == expected_chunks
1393
1394 with pytest.raises(ValueError):
1395 broadcast_to(a, a.shape, chunks=((2, 3), (1,), (3, 3)))
1396 with pytest.raises(ValueError):
1397 broadcast_to(a, a.shape, chunks=((3, 2), (3,), (3, 3)))
1398 with pytest.raises(ValueError):
1399 broadcast_to(a, (5, 2, 6), chunks=((3, 2), (3,), (3, 3)))
1400
1401
1402def test_broadcast_arrays():

Callers

nothing calls this directly

Calls 4

from_arrayFunction · 0.90
broadcast_toFunction · 0.90
assert_eqFunction · 0.90
integersMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…