DiverseBranchBlock
DiverseBranchBlock copied to clipboard
groups < out_channels is redundant
I think the if-else statement is redundant? Since if the groups parameter is greater than out_channels, an error(out_channels must divisible by groups) will be raised when we define the original convolution layer which above these lines.
if groups < out_channels:
self.dbb_avg.add_module("conv", nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=1, stride=1, padding=0, groups=groups, bias=False))
self.dbb_avg.add_module('bn', BNAndPadLayer(pad_pixels=padding, num_features=out_channels))
self.dbb_avg.add_module('avg', nn.AvgPool2d(kernel_size=kernel_size, stride=stride, padding=0))
self.dbb_1x1 = conv_bn(in_channels=in_channels, out_channels=out_channels, kernel_size=1, stride=stride,
padding=0, groups=groups)
else:
self.dbb_avg.add_module('avg', nn.AvgPool2d(kernel_size=kernel_size, stride=stride, padding=padding))
Hi, I just found the paper has mentioned about this part, however, for depthwise convolution, shouldn't we check for groups == in_channels instead of groups == out_channels in the code above?