Understanding goup in conv2d

I just want to make sure that i understand the meaning of group in conv2d correct.
can someone please tell me if im understanding right or not.
In the following figs, each color means different value

Hi,

The documentation states that both in_channels and out_channels should be divisible by groups.
Does your second and third example not throws errors?

Regarding the working of groups, essentially the in_channels is divided into sets, each containing in_channels / groups channels. Convolution is applied independently to these sets. You can think of it as having seperate convolution layers each seeing only part of the input channels. For each set the number of output channels is equal to out_channels / groups. The output of each of the sets is concatenated so that the final number of output channels is out_channels.

I tried to depict this as a diagram here: https://docs.google.com/presentation/d/163NU5vYkuqZKUYSYtWg8Hd9zrviuldh0q3P4WYXKjTg/edit?usp=sharing

1 Like

Yes actually it does through an error for 2, 3rd cases

I see, Thanks for the clarification. so we can never have groups more than in_channels
I copy and paste your explanation here for convenience: