dpnp.tensor.moveaxis

dpnp.tensor.moveaxis(X, source, destination, /)[source]

Moves axes of an array to new positions.

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

  • source ({int, sequence of ints}) -- Original positions of the axes to move. These must be unique. If x has rank (i.e., number of dimensions) N, a valid axis must be in the half-open interval [-N, N).

  • destination ({int, sequence of ints}) -- Destination positions for each of the original axes. These must also be unique. 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 moved 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.

  • ValueError -- If src and dst have not equal number of elements.