Direction of rotation of torch.rot90
In the documentation for torch.rot90 it is stated that

Rotation direction is from the first towards the second axis if k &gt; 0, and from the second towards the first for k &lt; 0.

However say that we are rotating from axis 0 to axis 1, is axis 0 rotating to axis 1 in the clockwise or anti-clockwise direction? (since they are both 90 degree rotations as per the image below)


axis=0 is the dimension that points downwards, while axis=1 points to the right. Visualize the axes like this:
---------&gt; axis=1
|
|
|
\/
axis=0

Now, k&gt;0 means counter-clockwise direction, k&lt;0 is clockwise.
Thus,
&gt;&gt;&gt; x = torch.arange(6).view(3, 2)
&gt;&gt;&gt; x
tensor([[0, 1],
        [2, 3],
        [4, 5]])

&gt;&gt;&gt; torch.rot90(x, 1, [0,1])
tensor([[1, 3, 5],
        [0, 2, 4]])

&gt;&gt;&gt; torch.rot90(x, 1, [1,0])
tensor([[4, 2, 0],
        [5, 3, 1]])


The torch.rot90()  is similar to numpy.rot90()
e.g.
numpy.rot90(m, k=1, axes=(0, 1))
mean

