dpnp.tensor.swapaxes

dpnp.tensor.swapaxes(X, axis1, axis2)[source]

Interchanges two axes of an array.

Parameters:
  • x (usm_ndarray) -- Input array.

  • axis1 (int) -- First axis. If x has rank (i.e., number of dimensions) N, a valid axis must be in the half-open interval [-N, N).

  • axis2 (int) -- Second axis. If x has rank (i.e., number of dimensions) N, a valid axis must be in the half-open interval [-N, N).

Returns:

out -- Array with swapped axes. The returned array has the same data type as x, is created on the same device as x and has the same USM allocation type as x.

Return type:

usm_ndarray

Raises:

AxisError -- If axis value is invalid.