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

Method _layer

dask/array/_array_expr/_expr.py:257–271  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

255 return f"stack-{self.deterministic_token}"
256
257 def _layer(self) -> dict:
258 axis = self.axis
259 cum_dims = [0] + list(accumulate(add, [len(a.chunks[axis]) for a in self.args]))
260 keys = list(product([self._name], *[range(len(bd)) for bd in self.chunks]))
261 names = [a.name for a in self.args]
262
263 values = [
264 (names[bisect(cum_dims, key[axis + 1]) - 1],)
265 + key[1 : axis + 1]
266 + (key[axis + 1] - cum_dims[bisect(cum_dims, key[axis + 1]) - 1],)
267 + key[axis + 2 :]
268 for key in keys
269 ]
270
271 return dict(zip(keys, values))
272
273
274class FinalizeComputeArray(FinalizeCompute, ArrayExpr):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected