copyrightly:

so pytorch generate a filter of the corresponding size and do the convolution.


That shouldn’t be the case, as luckily PyTorch raises a loud RuntimeError, if that’s the case:
x = torch.randn(1, 1, 4, 4, device='cuda')
filt = torch.randn(6, 1, 3, 3, device='cuda')
output = F.conv2d(x, filt)  # works

filt = filt.cpu()
output = F.conv2d(x, filt)
> RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same