I am trying to use torch.conv2d
or torch.nn.functional.conv2d
with groups specified, but it reports runtime error. The code is something like this:
a = torch.rand(4, 3, 8, 8)
b = torch.ones(3, 3, 3)
out = torch.conv2d(a, b, groups=3)
The error is something like this:
RuntimeError: expected stride to be a single integer value or a list of 1 values to match the convolution dimensions, but got stride=[1, 1]
Changing torch.conv2d
to torch.nn.functional.conv2d
gives the same error.
The following code works:
a = torch.rand(4, 3, 8, 8)
b = torch.ones(3, 3, 3, 3)
out = torch.conv2d(a, b)
and the following also works:
a = torch.rand(4, 3, 8, 8)
b = torch.ones(3, 3, 3, 3)
out = torch.conv2d(a, b, groups=1)