dask 2021.10.0

NotesParametersReturnsBackRef
apply_over_axes(func, a, axes)

This docstring was copied from numpy.apply_over_axes.

Some inconsistencies with the Dask version may exist.

func is called as :None:None:`res = func(a, axis)`, where :None:None:`axis` is the first element of :None:None:`axes`. The result :None:None:`res` of the function call must have either the same dimensions as a or one less dimension. If :None:None:`res` has one less dimension than a, a dimension is inserted before :None:None:`axis`. The call to func is then repeated for each axis in :None:None:`axes`, with :None:None:`res` as the first argument.

Notes

This function is equivalent to tuple axis arguments to reorderable ufuncs with keepdims=True. Tuple axis arguments to ufuncs have been available since version 1.7.0.

Parameters

func : function

This function must take two arguments, :None:None:`func(a, axis)`.

a : array_like

Input array.

axes : array_like

Axes over which func is applied; the elements must be integers.

Returns

apply_over_axis : ndarray

The output array. The number of dimensions is the same as a, but the shape can be different. This depends on whether func changes the shape of its output with respect to its input.

Apply a function repeatedly over multiple axes.

See Also

apply_along_axis

Apply a function to 1-D slices of an array along the given axis.

Examples

This example is valid syntax, but we were not able to check execution
>>> a = np.arange(24).reshape(2,3,4)  # doctest: +SKIP
... a # doctest: +SKIP array([[[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]], [[12, 13, 14, 15], [16, 17, 18, 19], [20, 21, 22, 23]]])

Sum over axes 0 and 2. The result has same number of dimensions as the original array:

This example is valid syntax, but we were not able to check execution
>>> np.apply_over_axes(np.sum, a, [0,2])  # doctest: +SKIP
array([[[ 60],
        [ 92],
        [124]]])

Tuple axis arguments to ufuncs are equivalent:

This example is valid syntax, but we were not able to check execution
>>> np.sum(a, axis=(0,2), keepdims=True)  # doctest: +SKIP
array([[[ 60],
        [ 92],
        [124]]])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

dask.array.routines.apply_along_axis

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /dask/array/routines.py#493
type: <class 'function'>
Commit: