cupy.apply_along_axis#
- cupy.apply_along_axis(func1d, axis, arr, *args, **kwargs)[source]#
Apply a function to 1-D slices along the given axis.
- Parameters
func1d (function (M,) -> (Nj...)) – This function should accept 1-D arrays. It is applied to 1-D slices of
arr
along the specified axis. It must return a 1-Dcupy.ndarray
.axis (integer) – Axis along which
arr
is sliced.arr (cupy.ndarray (Ni..., M, Nk...)) – Input array.
args – Additional arguments for
func1d
.kwargs – Additional keyword arguments for
func1d
.
- Returns
The output array. The shape of
out
is identical to the shape ofarr
, except along theaxis
dimension. This axis is removed, and replaced with new dimensions equal to the shape of the return value offunc1d
. So iffunc1d
returns a scalarout
will have one fewer dimensions thanarr
.- Return type
See also