I have landscape photos (135,240) but I have photo in portrait (240,135): rotate by -90 deg. Is there a way to this in pytorch ? Thank you

I think `permute`

and `flip`

should work here:

```
x = torch.zeros(135, 240)
# Draw reference lines
x[:, 0:10] = torch.arange(x.size(0)).unsqueeze(1).float()
x[0:10, :] = torch.arange(x.size(1)).unsqueeze(0).float() * 2
plt.imshow(x.numpy())
x_trans = x.permute(1, 0).flip(0)
plt.imshow(x_trans.numpy())
```

1 Like

thanks. permute & flip can used for multiples of 90 rotations. I got lucky, a simple transpose worked for me. thanks a lot.