Closed mfischer-ucl closed 3 years ago
Hi, I'm sorry for the late reply. Thank you for reporting this bug!
There have been changes to the way ConvNd
modules have worked in the later versions of PyTorch (probably 1.9?). In particular, PyTorch introduced a _conv_forward
method that is very convenient for Torchmeta, since we can just use this function, without having to copy the behavior of PyTorch (which may break, as was the case here). I will do the change and update the version of Torchmeta.
This is now fixed in Torchmeta 1.8.0.
Hi everyone, thanks for the great torchmeta-framework. It's really useful!
I believe I've spotted a bug in the torchmeta-class MetaConv2d, specificially for the case of circular padding. The torchmeta output shapes don't match the shapes provided by the corresponding torch function. Below is a MWE to replicate the problem:
I've identified the source of the issue to be the handling of the circular padding case in the torchmeta conv.py module, specifically line 36:
Exchanging this line with the (blatantly copied) version from torch.nn.Conv2d:
resolves the issue and makes both outputs have the same shape (in the above MWE:
[1, 12, 512, 512]
).I've just tested this with a couple of networks, and so far it seems to work fine. Not sure though whether the entire
if padding == 'circular'
branch in torchmeta could be interchanged for the simpler pytorch equivalent (line 439). @tristandeleu