MCPcopy
hub / github.com/dask/dask / ArraySliceDep

Class ArraySliceDep

dask/layers.py:78–89  ·  view source on GitHub ↗

Produce slice(s) into the full-sized array given a chunk index

Source from the content-addressed store, hash-verified

76
77
78class ArraySliceDep(ArrayBlockwiseDep):
79 """Produce slice(s) into the full-sized array given a chunk index"""
80
81 starts: tuple[tuple[int, ...], ...]
82
83 def __init__(self, chunks: tuple[tuple[int, ...], ...]):
84 super().__init__(chunks)
85 self.starts = tuple(cached_cumsum(c, initial_zero=True) for c in chunks)
86
87 def __getitem__(self, idx: tuple):
88 loc = tuple((start[i], start[i + 1]) for i, start in zip(idx, self.starts))
89 return tuple(slice(*s, None) for s in loc)
90
91
92class ArrayBlockIdDep(ArrayBlockwiseDep):

Callers 3

test_array_slice_depsFunction · 0.90
graph_from_arraylikeFunction · 0.90
storeFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_array_slice_depsFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…