dpnp.rot90
- dpnp.rot90(m, k=1, axes=(0, 1))[source]
Rotate an array by 90 degrees in the plane specified by axes.
Rotation direction is from the first towards the second axis. This means for a 2D array with the default k and axes, the rotation will be counterclockwise.
For full documentation refer to
numpy.rot90.- Parameters:
m ({dpnp.ndarray, usm_ndarray}) -- Array of two or more dimensions.
k (integer, optional) --
Number of times the array is rotated by 90 degrees.
Default:
1.axes ((2,) array_like of ints, optional) --
The array is rotated in the plane defined by the axes. Axes must be different.
Default:
(0, 1).
- Returns:
out -- A rotated view of m.
- Return type:
dpnp.ndarray
See also
dpnp.flipReverse the order of elements in an array along the given axis.
dpnp.fliplrFlip an array horizontally.
dpnp.flipudFlip an array vertically.
Notes
rot90(m, k=1, axes=(1, 0))is the reverse ofrot90(m, k=1, axes=(0, 1)).rot90(m, k=1, axes=(1, 0))is equivalent torot90(m, k=-1, axes=(0, 1)).Examples
>>> import dpnp as np >>> m = np.array([[1, 2], [3, 4]]) >>> m array([[1, 2], [3, 4]]) >>> np.rot90(m) array([[2, 4], [1, 3]]) >>> np.rot90(m, 2) array([[4, 3], [2, 1]]) >>> m = np.arange(8).reshape((2, 2, 2)) >>> np.rot90(m, 1, (1, 2)) array([[[1, 3], [0, 2]], [[5, 7], [4, 6]]])