Conv2d optional parameter,' group', how it realized

input = torch.autograd.Variable(torch.randn(1, 2*4, 4, 4)) conv=torch.nn.Conv2d(in_channels=2*4,out_channels=3*4,kernel_size=3,groups=4) output=conv2(input)
run the code, I got output as 1x12x2x2=1x3*4x2x2: Is it mean output channel 3:5 is got equally
as
’conv1=torch.nn.Conv2d(in_channels=2,out_channels=3,kernel_size=3,groups=1)
output1=conv1(input[:,3:5,:,:])’ ?
If ignore difference from intialization of W and b, ‘output[:,3:5,:,:] is equal to output1’?

I’m not sure I understand. To my understanding, you’re asking if performing a grouped convolution is the same as performing a standard convolution from each group of input channels to their respective group of output channels.

I believe the answer is yes. Having 4 groups would be equivalent to having 4 conv. layers side by side.

From the docs:

At groups=2, the operation becomes equivalent to having two conv layers side by side, each seeing half the input channels, and producing half the output channels, and both subsequently concatenated.