I have a Tensor of images of size [B, C, H, W] and I want to rotate each of them by a specific angle from the Tensor of angles of size [B].
For example, I have Tensor of images of size [2, 1, 3, 3] and angles of size [2]:
t = torch.Tensor([
[[[0, 0, 0],
[2, 0, 1],
[0, 0, 0]]],
[[[0, 2, 0],
[0, 0, 0],
[0, 1, 0]]]])
r = torch.Tensor([-180, -90])
result should be:
torch.Tensor([
[[[0, 0, 0],
[1, 0, 2],
[0, 0, 0]]],
[[[0, 0, 0],
[1, 0, 2],
[0, 0, 0]]]])
How can I do it?