Hi,
I have the following minimal code example:
import torch
import torch.nn.functional as F
x = torch.rand(1 , 1, 100, 100) - 0.5
w = torch.rand(1 , 1, 5, 5) - 0.5
y1 = F.conv2d(x, w, stride=1, padding=0)
x90 = torch.rot90(x, 1, (2,3))
w90 = torch.rot90(w, 1, (2,3))
y2 = F.conv2d(x90, w90, stride=1, padding=0)
y1_rot = torch.rot90(y1, 1, (2,3))
print(torch.allclose(y2, y1_rot)) # returns False
My expectation:
-
If I rotate the input by 90° and also rotate the kernel by 90°, then apply convolution, the result should be the rotated version of the original convolution output.
-
In other words, I expected
y2 == rot90(y1)
up to floating point tolerance.
But in practice the code prints False
.
Is this behavior expected in torch.nn.functional.conv2d
?
Thanks in advance!