mindspore.numpy.rot90
- mindspore.numpy.rot90(a, k=1, axes=(0, 1))[source]
Rotates a tensor by 90 degrees in the plane specified by axes. Rotation direction is from the first towards the second axis.
- Parameters
- Returns
Tensor.
- Raises
TypeError – if input a is not a Tensor or the argument k is not integer or the argument axes is not tuple of integers or list of ints.
ValueError – if any axis is out of range or the length of axes is not 2.
- Supported Platforms:
GPU
Examples
>>> import mindspore.numpy as np >>> a = np.arange(24).reshape((2, 3, 4)) >>> output = np.rot90(a) >>> print(output) [[[ 8 9 10 11] [20 21 22 23]] [[ 4 5 6 7] [16 17 18 19]] [[ 0 1 2 3] [12 13 14 15]]] >>> output = np.rot90(a, 3, (1, 2)) >>> print(output) [[[ 8 4 0] [ 9 5 1] [10 6 2] [11 7 3]] [[20 16 12] [21 17 13] [22 18 14] [23 19 15]]]