jax.numpy.flip

Contents

jax.numpy.flip#

jax.numpy.flip(m, axis=None)[source]#

Reverse the order of elements in an array along the given axis.

LAX-backend implementation of numpy.flip().

The JAX version of this function may in some cases return a copy rather than a view of the input.

Original docstring below.

The shape of the array is preserved, but the elements are reordered.

Added in version 1.12.0.

Parameters:
  • m (array_like) – Input array.

  • axis (None or int or tuple of ints, optional) –

    Axis or axes along which to flip over. The default, axis=None, will flip over all of the axes of the input array. If axis is negative it counts from the last to the first axis.

    If axis is a tuple of ints, flipping is performed on all of the axes specified in the tuple.

    Changed in version 1.15.0: None and tuples of axes are supported

Returns:

out – A view of m with the entries of axis reversed. Since a view is returned, this operation is done in constant time.

Return type:

array_like