Produce slice(s) into the full-sized array given a chunk index
| 76 | |
| 77 | |
| 78 | class 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 | |
| 92 | class ArrayBlockIdDep(ArrayBlockwiseDep): |
no outgoing calls
searching dependent graphs…