dpnp.moveaxis
- dpnp.moveaxis(a, source, destination)[source]
Move axes of an array to new positions. Other axes remain in their original order.
For full documentation refer to
numpy.moveaxis.- Parameters:
a ({dpnp.ndarray, usm_ndarray}) -- The array whose axes should be reordered.
source (int or sequence of int) -- Original positions of the axes to move. These must be unique.
destination (int or sequence of int) -- Destination positions for each of the original axes. These must also be unique.
- Returns:
out -- Array with moved axes. This array is a view of the input array.
- Return type:
dpnp.ndarray
See also
dpnp.transposePermute the dimensions of an array.
dpnp.swapaxesInterchange two axes of an array.
Examples
>>> import dpnp as np >>> x = np.zeros((3, 4, 5)) >>> np.moveaxis(x, 0, -1).shape (4, 5, 3) >>> np.moveaxis(x, -1, 0).shape (5, 3, 4)