def __init__(self, in_channels, out_channels, mid_channels, kernel_size=3, stride=1, se_cfg=None, with_expand_conv=True, conv_cfg=None, norm_cfg=dict(type='BN'), act_cfg=dict(type='ReLU'), with_cp=False):
    super(InvertedResidualV3, self).__init__()
    self.with_res_shortcut = ((stride == 1) and (in_channels == out_channels))
    assert (stride in [1, 2])
    self.with_cp = with_cp
    self.with_se = (se_cfg is not None)
    self.with_expand_conv = with_expand_conv
    if self.with_se:
        assert isinstance(se_cfg, dict)
    if (not self.with_expand_conv):
        assert (mid_channels == in_channels)
    if self.with_expand_conv:
        self.expand_conv = ConvModule(in_channels=in_channels, out_channels=mid_channels, kernel_size=1, stride=1, padding=0, conv_cfg=conv_cfg, norm_cfg=norm_cfg, act_cfg=act_cfg)
    self.depthwise_conv = ConvModule(in_channels=mid_channels, out_channels=mid_channels, kernel_size=kernel_size, stride=stride, padding=(kernel_size // 2), groups=mid_channels, conv_cfg=(dict(type='Conv2dAdaptivePadding') if (stride == 2) else conv_cfg), norm_cfg=norm_cfg, act_cfg=act_cfg)
    if self.with_se:
        self.se = SELayer(**se_cfg)
    self.linear_conv = ConvModule(in_channels=mid_channels, out_channels=out_channels, kernel_size=1, stride=1, padding=0, conv_cfg=conv_cfg, norm_cfg=norm_cfg, act_cfg=None)
def __init__(self, in_channels, out_channels, mid_channels, kernel_size=3, stride=1, se_cfg=None, with_expand_conv=True, conv_cfg=None, norm_cfg=dict(type='BN'), act_cfg=dict(type='ReLU'), with_cp=False):
    super(InvertedResidualV3, self).__init__()
    self.with_res_shortcut = ((stride == 1) and (in_channels == out_channels))
    assert (stride in [1, 2])
    self.with_cp = with_cp
    self.with_se = (se_cfg is not None)
    self.with_expand_conv = with_expand_conv
    if self.with_se:
        assert isinstance(se_cfg, dict)
    if (not self.with_expand_conv):
        assert (mid_channels == in_channels)
    if self.with_expand_conv:
        self.expand_conv = ConvModule(in_channels=in_channels, out_channels=mid_channels, kernel_size=1, stride=1, padding=0, conv_cfg=conv_cfg, norm_cfg=norm_cfg, act_cfg=act_cfg)
    self.depthwise_conv = ConvModule(in_channels=mid_channels, out_channels=mid_channels, kernel_size=kernel_size, stride=stride, padding=(kernel_size // 2), groups=mid_channels, conv_cfg=(dict(type='Conv2dAdaptivePadding') if (stride == 2) else conv_cfg), norm_cfg=norm_cfg, act_cfg=act_cfg)
    if self.with_se:
        self.se = SELayer(**se_cfg)
    self.linear_conv = ConvModule(in_channels=mid_channels, out_channels=out_channels, kernel_size=1, stride=1, padding=0, conv_cfg=conv_cfg, norm_cfg=norm_cfg, act_cfg=None)