zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    JFreeChart API 说明(转)
    杭电1064
    杭电2734
    杭电1170
    杭电1197
    杭电2629
    杭电1062
    杭电2088
    杭电1205
    杭电1004
  • 原文地址:https://www.cnblogs.com/ywheunji/p/12532417.html
Copyright © 2011-2022 走看看