Pytorch conv2D groups

Hi everyone,

I was wondering about pytorch’s Conv2D (also 1D, ND…) argument ‘groups’.

My previous layer returns 8 channels, and for each of those, I’d like to learn 2 new ones (i.e., in_channels=8, out_channels=16, groups=8), resulting in a total of 16 channels after the current layer.

My issue now is that the weights of that second layer then have the channel dimension of 16 (not a more comprehensible (8,2) clearly assigning 2 output channels to 1 input channel), but I’d like to trace EXACTLY which new kernel weights have been learned for each previous channel output, i.e., that an input at channel m of the previous layer results in outputs at channels n,k in the following layer.

So does anyone know how the output channels are structured? For example, do channels 1-8 of the output correspond to the first learned filter for each input channel, and channels 9-16 of the output correspond to the second?

Thanks for the help!

This post might be helpful.

Awesome, thanks a lot!