Another upvote for @amazing_coder’s code.
@ptrblck’s code looks like working but it actually flips along another axis. Suppose you have a cat image, and you apply a horizontal flip and call it a 180 degree rotation, that’s not accurate, right? The same happens with tensor.transpose. That’s why you need another flip to correct the orientation (e.g., a vertical flip for the cat case).
Here, just to generalize the solution.
# x is a tensor, and d1, d2 are the dimensions of your interest, then
x90 = x.transpose(d1, d2).flip(d1)
x180 = x.flip(d1).flip(d2)
x270 = x.transpose(d1, d2).flip(d2)

Note that d1,d2 are 0-indexed.