I have a problem in understanding convtranspose2d with stride in pytorch.
According to this paper https://arxiv.org/pdf/1603.07285.pdf, convtranspose2d with stride is equivalent to a convolution on a modified input by insterting 0s between the entries (that’s why it is sometimes called fractionnally strided convolution).
I run a quick test but it doesnt work and I don’t understand why. Could someone explain what is wrong here ?
x = torch.rand(1,1,20,20)
k = torch.rand(1,1,3,3)
w = torch.zeros(3, 3)
w[1, 1] = 1
zerofill = F.conv_transpose2d(x, w.expand(1, 1, 3, 3),stride=2) #interleave tensor x with 0s
out1 = F.conv_transpose2d(x,k,stride=2)
out2 = F.conv2d(zerofill,k,padding=1)
err = (out1-out2).pow(2)
print(err.sum().item()) # large error