I’m reading the code of Pytorch recently and could not understand the dimension of the weights of a CNN layer.
Link to the code I’m talking about from github.
The weight is defined as:
self.weight = Parameter(torch.Tensor( out_channels, in_channels // groups, *kernel_size))
However, if the
in_channels = 3, out_channels = 9, groups = 1, then there will be 27 weight matrix of
*kernel_size (27 filters) created.
But, I think, there should be only 3 weight matrix of
*kernel_size (3 filters) and they are shared among the 3 input channels, isn’t it?
Could anyone told me which part of my thinking is wrong?