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

Function zero_broadcast_dimensions

dask/blockwise.py:1423–1441  ·  view source on GitHub ↗

>>> lol = [('x', 1, 0), ('x', 1, 1), ('x', 1, 2)] >>> nblocks = (4, 1, 2) # note singleton dimension in second place >>> lol = [[('x', 1, 0, 0), ('x', 1, 0, 1)], ... [('x', 1, 1, 0), ('x', 1, 1, 1)], ... [('x', 1, 2, 0), ('x', 1, 2, 1)]] >>> zero_broadcast_di

(lol, nblocks)

Source from the content-addressed store, hash-verified

1421
1422@_deprecated()
1423def zero_broadcast_dimensions(lol, nblocks):
1424 """
1425 >>> lol = [('x', 1, 0), ('x', 1, 1), ('x', 1, 2)]
1426 >>> nblocks = (4, 1, 2) # note singleton dimension in second place
1427 >>> lol = [[('x', 1, 0, 0), ('x', 1, 0, 1)],
1428 ... [('x', 1, 1, 0), ('x', 1, 1, 1)],
1429 ... [('x', 1, 2, 0), ('x', 1, 2, 1)]]
1430
1431 >>> zero_broadcast_dimensions(lol, nblocks) # doctest: +SKIP
1432 [[('x', 1, 0, 0), ('x', 1, 0, 1)],
1433 [('x', 1, 0, 0), ('x', 1, 0, 1)],
1434 [('x', 1, 0, 0), ('x', 1, 0, 1)]]
1435
1436 See Also
1437 --------
1438 lol_tuples
1439 """
1440 f = lambda t: (t[0],) + tuple(0 if d == 1 else i for i, d in zip(t[1:], nblocks))
1441 return homogeneous_deepmap(f, lol)
1442
1443
1444def broadcast_dimensions(argpairs, numblocks, sentinels=(1, (1,)), consolidate=None):

Callers

nothing calls this directly

Calls 1

homogeneous_deepmapFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…