MCPcopy
hub / github.com/dask/dask / _chunk_sum

Function _chunk_sum

dask/array/routines.py:361–378  ·  view source on GitHub ↗
(a, axis=None, dtype=None, keepdims=None)

Source from the content-addressed store, hash-verified

359
360
361def _chunk_sum(a, axis=None, dtype=None, keepdims=None):
362 # Caution: this is not your conventional array-sum: due
363 # to the special nature of the preceding blockwise con-
364 # traction, each chunk is expected to have exactly the
365 # same shape, with a size of 1 for the dimension given
366 # by `axis` (the reduction axis). This makes mere ele-
367 # ment-wise addition of the arrays possible. Besides,
368 # the output can be merely squeezed to lose the `axis`-
369 # dimension when keepdims = False
370 if type(a) is list:
371 out = reduce(partial(np.add, dtype=dtype), a)
372 else:
373 out = a
374
375 if keepdims:
376 return out
377 else:
378 return out.squeeze(axis[0])
379
380
381def _sum_wo_cat(a, axis=None, dtype=None):

Callers

nothing calls this directly

Calls 1

squeezeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…