jax.numpy.transpose(a, axes=None)[source]#

Reverse or permute the axes of an array; returns the modified array.

LAX-backend implementation of numpy.transpose().

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

Original docstring below.

For an array a with two axes, transpose(a) gives the matrix transpose.

Refer to numpy.ndarray.transpose for full documentation.

  • a (array_like) – Input array.

  • axes (tuple or list of ints, optional) – If specified, it must be a tuple or list which contains a permutation of [0,1,..,N-1] where N is the number of axes of a. The i’th axis of the returned array will correspond to the axis numbered axes[i] of the input. If not specified, defaults to range(a.ndim)[::-1], which reverses the order of the axes.


p – a with its axes permuted. A view is returned whenever possible.

Return type