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. Returns ------- p : ndarray `a` with its axes permuted. A view is returned whenever possible. See Also -------- ndarray.transpose : Equivalent method. moveaxis : Move axes of an array to new positions. argsort : Return the indices that would sort an array. Notes ----- Use ``transpose(a, argsort(axes))`` to invert the transposition of tensors when using the `axes` keyword argument. Examples -------- >>> a = np.array([[1, 2], [3, 4]]) >>> a array([[1, 2], [3, 4]]) >>> np.transpose(a) array([[1, 3], [2, 4]]) >>> a = np.array([1, 2, 3, 4]) >>> a array([1, 2, 3, 4]) >>> np.transpose(a) array([1, 2, 3, 4]) >>> a = np.ones((1, 2, 3)) >>> np.transpose(a, (1, 0, 2)).shape (2, 1, 3) >>> a = np.ones((2, 3, 4, 5)) >>> np.transpose(a).shape (5, 4, 3, 2) r: