Grunwalski
Grunwalski

Reputation: 129

How does the groups parameter in torch.nn.conv* influence the convolution process?

I want to convolve a multichannel tensor with the same single channel weight. I could repeat the weight along the channel dimension, but I thought there might be an other way.

I thought the groups parameter might do the job. However I don't understand the documentation. That's why I want to ask how the groups parameter influences the convolution process ?

Upvotes: 2

Views: 2287

Answers (1)

prosti
prosti

Reputation: 46401

Just minor tips since I never used it.

Group parameter multiplies the number of kernels you would normally have. So if you set group=2, expect 2 times more kernels.

The definition of conv2d in PyTorch states group is 1 by default.

If you increase the group you get the depth-wise convolution, where each input channel is getting specific kernels per se.

The constraint is both in and out channels should be dividable by group number.

I think in Tensorfolow you can read the documentation of SeparableConv2D since this is what is equivalent when group>1.

Upvotes: 1

Related Questions