Skip to main content

transpose

Permute the dimensions of an array. When called without axes, reverses the dimension order. Returns a view (no data is copied). Also available as np.linalg.transpose(...).
Returns: NDArray — View of a with its axes permuted.

swapaxes

Interchange two axes of an array. Returns a view.
Returns: NDArray — View of a with the two specified axes swapped.

moveaxis

Move axes of an array to new positions. Other axes remain in their original order. Returns a view.
Returns: NDArray — View of a with the specified axes moved.

rollaxis

Roll the specified axis backwards until it lies at the given position. Returns a view.
Returns: NDArray — View of a with the axis rolled to the target position.

permute_dims

Permute the dimensions of an array. This is the Array API-compatible equivalent of transpose. Also available as np.linalg.permute_dims(...).
Returns: NDArray — View of a with its axes permuted.

matrix_transpose

Transpose the last two dimensions of an array. The input must have at least 2 dimensions. Returns a view. Also available as np.linalg.matrix_transpose(...).
Returns: NDArray — View of a with the last two axes swapped.