GroupedConv2d
Grouped Convolution layer.
In grouped convolution, the input channels are divided into groups, and each group is convolved separately with its own set of filters. This reduces the number of parameters and computational complexity while potentially improving feature learning by encouraging different groups to learn different types of features.
When groups = 1, this is equivalent to standard convolution. When groups = inChannels, this is equivalent to depthwise convolution.
This is essentially a convenience wrapper around Conv2d with explicit group handling and additional utility methods for grouped convolution operations.
Parameters
Number of input channels
Number of output channels/filters
Size of the convolving kernel (height, width)
Number of groups to divide channels into
Stride of the convolution (default: 1, 1)
Padding added to all sides of the input (default: 0, 0)
Spacing between kernel elements (default: 1, 1)
Whether to add a learnable bias to the output (default: true)
Name of the module
Initial weights tensor
Initial bias tensor (if bias is true)
Constructors
Functions
Returns the computational complexity reduction ratio compared to standard convolution. This is the same as parameter reduction for convolution operations.
Returns information about the grouped convolution configuration.
Returns the number of input channels per group.
Checks if this is a depthwise convolution (groups == inChannels).
Checks if this is a standard convolution (groups == 1).
Returns the number of output channels per group.
Returns the total number of parameters in this layer.
Returns the parameter reduction ratio compared to a standard convolution (groups = 1).