MCPcopy
hub / github.com/dask/dask / reduction

Function reduction

dask/array/_reductions_generic.py:25–212  ·  view source on GitHub ↗

General version of reductions Parameters ---------- x: Array Data being reduced along one or more axes chunk: callable(x_chunk, [weights_chunk=None], axis, keepdims) First function to be executed when resolving the dask graph. This function is applied in para

(
    x,
    chunk,
    aggregate,
    axis=None,
    keepdims=False,
    dtype=None,
    split_every=None,
    combine=None,
    name=None,
    out=None,
    concatenate=True,
    output_size=1,
    meta=None,
    weights=None,
)

Source from the content-addressed store, hash-verified

23
24
25def reduction(
26 x,
27 chunk,
28 aggregate,
29 axis=None,
30 keepdims=False,
31 dtype=None,
32 split_every=None,
33 combine=None,
34 name=None,
35 out=None,
36 concatenate=True,
37 output_size=1,
38 meta=None,
39 weights=None,
40):
41 """General version of reductions
42
43 Parameters
44 ----------
45 x: Array
46 Data being reduced along one or more axes
47 chunk: callable(x_chunk, [weights_chunk=None], axis, keepdims)
48 First function to be executed when resolving the dask graph.
49 This function is applied in parallel to all original chunks of x.
50 See below for function parameters.
51 combine: callable(x_chunk, axis, keepdims), optional
52 Function used for intermediate recursive aggregation (see
53 split_every below). If omitted, it defaults to aggregate.
54 If the reduction can be performed in less than 3 steps, it will not
55 be invoked at all.
56 aggregate: callable(x_chunk, axis, keepdims)
57 Last function to be executed when resolving the dask graph,
58 producing the final output. It is always invoked, even when the reduced
59 Array counts a single chunk along the reduced axes.
60 axis: int or sequence of ints, optional
61 Axis or axes to aggregate upon. If omitted, aggregate along all axes.
62 keepdims: boolean, optional
63 Whether the reduction function should preserve the reduced axes,
64 leaving them at size ``output_size``, or remove them.
65 dtype: np.dtype
66 data type of output. This argument was previously optional, but
67 leaving as ``None`` will now raise an exception.
68 split_every: int >= 2 or dict(axis: int), optional
69 Determines the depth of the recursive aggregation. If set to or more
70 than the number of input chunks, the aggregation will be performed in
71 two steps, one ``chunk`` function per input chunk and a single
72 ``aggregate`` function at the end. If set to less than that, an
73 intermediate ``combine`` function will be used, so that any one
74 ``combine`` or ``aggregate`` function has no more than ``split_every``
75 inputs. The depth of the aggregation graph will be
76 :math:`\\log_\\text{split_every}(\\text{input chunks along reduced axes})`.
77 Setting to a low value can reduce cache size and network transfers, at
78 the cost of more CPU and a larger dask graph.
79
80 Omit to let dask heuristically decide a good default. A default can
81 also be set globally with the ``split_every`` key in
82 :mod:`dask.config`.

Callers 15

countFunction · 0.90
sumFunction · 0.90
prodFunction · 0.90
minFunction · 0.90
maxFunction · 0.90
anyFunction · 0.90
allFunction · 0.90
nansumFunction · 0.90
nanprodFunction · 0.90
nanminFunction · 0.90
nanmaxFunction · 0.90
meanFunction · 0.90

Calls 9

validate_axisFunction · 0.90
getargspecFunction · 0.90
is_series_likeFunction · 0.90
asanyarrayFunction · 0.90
broadcast_toFunction · 0.90
blockwiseFunction · 0.90
compute_metaFunction · 0.90
handle_outFunction · 0.90
_tree_reduceFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…