dpctl.tensor.moveaxis

dpctl.tensor.moveaxis(x, source, destination)[source]

Moves axes of an array to new positions.

Parameters:
  • x (usm_ndarray) – input array

  • source (int or a sequence of int) – 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 or a sequence of int) – 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:

Array with moved axes. The returned array must 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.