pyotrch--nn.Conv2d中groups參數的理解


調用形式:    
self.conv2 = nn.Conv2d(expand_size, expand_size, kernel_size=kernel_size, stride=stride,
                               padding=kernel_size / 2, groups=expand_size, bias=False)

官方參數說明:

Args:
        in_channels (int): Number of channels in the input image out_channels (int): Number of channels produced by the convolution kernel_size (int or tuple): Size of the convolving kernel stride (int or tuple, optional): Stride of the convolution. Default: 1 padding (int or tuple, optional): Zero-padding added to both sides of the input. Default: 0 padding_mode (string, optional). Accepted values `zeros` and `circular` Default: `zeros` dilation (int or tuple, optional): Spacing between kernel elements. Default: 1 groups (int, optional): Number of blocked connections from input channels to output channels. Default: 1 bias (bool, optional): If ``True``, adds a learnable bias to the output. Default: ``True``

group這個參數是用做分組卷積的,但是現在用的比較多的是groups = in_channel,可以參考上面英文文檔的最后一句。當groups = in_channel時,是在做的depth-wise conv的,具體思想可以參考MobileNet論文

 

缺點:參考shufflenet v2

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM