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

Function mean_combine

dask/array/reductions.py:343–364  ·  view source on GitHub ↗
(
    pairs,
    sum=chunk.sum,
    numel=numel,
    dtype="f8",
    axis=None,
    computing_meta=False,
    **kwargs,
)

Source from the content-addressed store, hash-verified

341
342
343def mean_combine(
344 pairs,
345 sum=chunk.sum,
346 numel=numel,
347 dtype="f8",
348 axis=None,
349 computing_meta=False,
350 **kwargs,
351):
352 if not isinstance(pairs, list):
353 pairs = [pairs]
354
355 ns = deepmap(lambda pair: pair["n"], pairs) if not computing_meta else pairs
356 n = _concatenate2(ns, axes=axis).sum(axis=axis, **kwargs)
357
358 if computing_meta:
359 return n
360
361 totals = deepmap(lambda pair: pair["total"], pairs)
362 total = _concatenate2(totals, axes=axis).sum(axis=axis, **kwargs)
363
364 return {"n": n, "total": total}
365
366
367def mean_agg(pairs, dtype="f8", axis=None, computing_meta=False, **kwargs):

Callers

nothing calls this directly

Calls 3

deepmapFunction · 0.90
_concatenate2Function · 0.90
sumMethod · 0.45

Tested by

no test coverage detected