(self, inplanes, planes, groups=1, base_width=4, **kwargs)
Bottleneck block for ResNeXt.
        If style is "pytorch", the stride-two layer is the 3x3 conv layer,
        if it is "caffe", the stride-two layer is the first 1x1 conv layer.
Bottleneck block for ResNeXt.
        If style is "pytorch", the stride-two layer is the 3x3 conv layer,
        if it is "caffe", the stride-two layer is the first 1x1 conv layer.
Bottleneck block for ResNeXt . If style is pytorch the stride - two layer is the 3x3 conv layer if it is caffe the stride - two layer is the first 1x1 conv layer .
def __init__(self, inplanes, planes, groups=1, base_width=4, **kwargs):
        """Bottleneck block for ResNeXt.
        If style is "pytorch", the stride-two layer is the 3x3 conv layer,
        if it is "caffe", the stride-two layer is the first 1x1 conv layer.
        """
        super(Bottleneck, self).__init__(inplanes, planes, **kwargs)

        if groups == 1:
            width = self.planes
        else:
            width = math.floor(self.planes * (base_width / 64)) * groups

        self.norm1_name, norm1 = build_norm_layer(
            self.norm_cfg, width, postfix=1)
        self.norm2_name, norm2 = build_norm_layer(
            self.norm_cfg, width, postfix=2)
        self.norm3_name, norm3 = build_norm_layer(
            self.norm_cfg, self.planes * self.expansion, postfix=3)

        self.conv1 = build_conv_layer(
            self.conv_cfg,
            self.inplanes,
            width,
            kernel_size=1,
            stride=self.conv1_stride,
            bias=False)
        self.add_module(self.norm1_name, norm1)
        fallback_on_stride = False
        self.with_modulated_dcn = False
        if self.with_dcn:
            fallback_on_stride = self.dcn.get('fallback_on_stride', False)
            self.with_modulated_dcn = self.dcn.get('modulated', False)
        if not self.with_dcn or fallback_on_stride:
            self.conv2 = build_conv_layer(
                self.conv_cfg,
                width,
                width,
                kernel_size=3,
                stride=self.conv2_stride,
                padding=self.dilation,
                dilation=self.dilation,
                groups=groups,
                bias=False)
        else:
            assert self.conv_cfg is None, 'conv_cfg must be None for DCN'
            groups = self.dcn.get('groups', 1)
            deformable_groups = self.dcn.get('deformable_groups', 1)
            if not self.with_modulated_dcn:
                conv_op = DeformConv
                offset_channels = 18
            else:
                conv_op = ModulatedDeformConv
                offset_channels = 27
            self.conv2_offset = nn.Conv2d(
                width,
                deformable_groups * offset_channels,
                kernel_size=3,
                stride=self.conv2_stride,
                padding=self.dilation,
                dilation=self.dilation)
            self.conv2 = conv_op(
                width,
                width,
                kernel_size=3,
                stride=self.conv2_stride,
                padding=self.dilation,
                dilation=self.dilation,
                groups=groups,
                deformable_groups=deformable_groups,
                bias=False)
        self.add_module(self.norm2_name, norm2)
        self.conv3 = build_conv_layer(
            self.conv_cfg,
            width,
            self.planes * self.expansion,
            kernel_size=1,
            bias=False)
        self.add_module(self.norm3_name, norm3)
def __init__ ( self , inplanes , planes , groups = 1 , base_width = 4 , * * kwargs ) : super ( Bottleneck , self ) . __init__ ( inplanes , planes , * * kwargs ) if groups == 1 : width = self . planes else : width = math . floor ( self . planes * ( base_width / 64 ) ) * groups self . norm1_name , norm1 = build_norm_layer ( self . norm_cfg , width , postfix = 1 ) self . norm2_name , norm2 = build_norm_layer ( self . norm_cfg , width , postfix = 2 ) self . norm3_name , norm3 = build_norm_layer ( self . norm_cfg , self . planes * self . expansion , postfix = 3 ) self . conv1 = build_conv_layer ( self . conv_cfg , self . inplanes , width , kernel_size = 1 , stride = self . conv1_stride , bias = False ) self . add_module ( self . norm1_name , norm1 ) fallback_on_stride = False self . with_modulated_dcn = False if self . with_dcn : fallback_on_stride = self . dcn . get ( 'fallback_on_stride' , False ) self . with_modulated_dcn = self . dcn . get ( 'modulated' , False ) if not self . with_dcn or fallback_on_stride : self . conv2 = build_conv_layer ( self . conv_cfg , width , width , kernel_size = 3 , stride = self . conv2_stride , padding = self . dilation , dilation = self . dilation , groups = groups , bias = False ) else : assert self . conv_cfg is None , 'conv_cfg must be None for DCN' groups = self . dcn . get ( 'groups' , 1 ) deformable_groups = self . dcn . get ( 'deformable_groups' , 1 ) if not self . with_modulated_dcn : conv_op = DeformConv offset_channels = 18 else : conv_op = ModulatedDeformConv offset_channels = 27 self . conv2_offset = nn . Conv2d ( width , deformable_groups * offset_channels , kernel_size = 3 , stride = self . conv2_stride , padding = self . dilation , dilation = self . dilation ) self . conv2 = conv_op ( width , width , kernel_size = 3 , stride = self . conv2_stride , padding = self . dilation , dilation = self . dilation , groups = groups , deformable_groups = deformable_groups , bias = False ) self . add_module ( self . norm2_name , norm2 ) self . conv3 = build_conv_layer ( self . conv_cfg , width , self . planes * self . expansion , kernel_size = 1 , bias = False ) self . add_module ( self . norm3_name , norm3 )