flip¶
- flip(x: array, /, *, axis: int | Tuple[int, ...] | None = None) array ¶
Reverses the order of elements in an array along the given axis.
- Parameters:
x (array) – input array.
axis (Optional[Union[int, Tuple[int, ...]]]) – axis (or axes) along which to reverse elements. A valid axis must be an integer on the interval
[-N, N)
, whereN
is the number of axes inx
. If an axis is specified as a negative integer, the function must determine the axis along which to perform the operation by counting backward from the last axis (where-1
refers to the last axis). If provided an invalid axis, the function must raise an exception. Ifaxis
isNone
, the function must flip all input array axes. If provided more than one axis, the function must flip only the specified axes. Default:None
.
- Returns:
out (array) – an output array. The returned array must have the same data type and shape as
x
. The returned array must have the same elements asx
, but which are reordered relative tox
.