MCPcopy
hub / github.com/dask/dask / cumdims_label

Function cumdims_label

dask/array/rechunk.py:33–43  ·  view source on GitHub ↗

Internal utility for cumulative sum with label. >>> cumdims_label(((5, 3, 3), (2, 2, 1)), 'n') # doctest: +NORMALIZE_WHITESPACE [(('n', 0), ('n', 5), ('n', 8), ('n', 11)), (('n', 0), ('n', 2), ('n', 4), ('n', 5))]

(chunks, const)

Source from the content-addressed store, hash-verified

31
32
33def cumdims_label(chunks, const):
34 """Internal utility for cumulative sum with label.
35
36 >>> cumdims_label(((5, 3, 3), (2, 2, 1)), 'n') # doctest: +NORMALIZE_WHITESPACE
37 [(('n', 0), ('n', 5), ('n', 8), ('n', 11)),
38 (('n', 0), ('n', 2), ('n', 4), ('n', 5))]
39 """
40 return [
41 tuple(zip((const,) * (1 + len(bds)), accumulate(add, (0,) + bds)))
42 for bds in chunks
43 ]
44
45
46def _breakpoints(cumold, cumnew):

Callers 2

test_rechunk_internals_1Function · 0.90
old_to_newFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_rechunk_internals_1Function · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…