def __init__(self, widen_factor=1.0, out_indices=(7,), frozen_stages=(- 1), deep_stem=False, conv_cfg=None, norm_cfg=dict(type='BN'), act_cfg=dict(type='ReLU'), norm_eval=False, with_cp=False, init_cfg=[dict(type='Kaiming', layer=['Conv2d']), dict(type='Constant', val=1, layer=['_BatchNorm', 'GroupNorm'])]):
    super(MobileNetV2, self).__init__(init_cfg)
    self.widen_factor = widen_factor
    self.out_indices = out_indices
    for index in out_indices:
        if (index not in range(0, 8)):
            raise ValueError(f'the item in out_indices must in range(0, 8). But received {index}')
    if (frozen_stages not in range((- 1), 8)):
        raise ValueError(f'frozen_stages must be in range(-1, 8). But received {frozen_stages}')
    self.out_indices = out_indices
    self.frozen_stages = frozen_stages
    self.conv_cfg = conv_cfg
    self.norm_cfg = norm_cfg
    self.act_cfg = act_cfg
    self.norm_eval = norm_eval
    self.with_cp = with_cp
    self.in_channels = make_divisible((32 * widen_factor), 8)
    if deep_stem:
        self.conv0 = ConvModule(in_channels=3, out_channels=16, kernel_size=3, stride=1, padding=1, conv_cfg=self.conv_cfg, norm_cfg=self.norm_cfg, act_cfg=self.act_cfg)
        in_channels_ = 16
    else:
        in_channels_ = 3
        self.conv0 = nn.Sequential()
    self.conv1 = ConvModule(in_channels=in_channels_, out_channels=self.in_channels, kernel_size=3, stride=2, padding=1, conv_cfg=self.conv_cfg, norm_cfg=self.norm_cfg, act_cfg=self.act_cfg)
    self.layers = []
    for (i, layer_cfg) in enumerate(self.arch_settings):
        (expand_ratio, channel, num_blocks, stride) = layer_cfg
        out_channels = make_divisible((channel * widen_factor), 8)
        inverted_res_layer = self.make_layer(out_channels=out_channels, num_blocks=num_blocks, stride=stride, expand_ratio=expand_ratio)
        layer_name = f'layer{(i + 1)}'
        self.add_module(layer_name, inverted_res_layer)
        self.layers.append(layer_name)
    if (widen_factor > 1.0):
        self.out_channel = int((1280 * widen_factor))
    else:
        self.out_channel = 1280
    layer = ConvModule(in_channels=self.in_channels, out_channels=self.out_channel, kernel_size=1, stride=1, padding=0, conv_cfg=self.conv_cfg, norm_cfg=self.norm_cfg, act_cfg=self.act_cfg)
    self.add_module('conv2', layer)
    self.layers.append('conv2')
def __init__(self, widen_factor=1.0, out_indices=(7,), frozen_stages=(- 1), deep_stem=False, conv_cfg=None, norm_cfg=dict(type='BN'), act_cfg=dict(type='ReLU'), norm_eval=False, with_cp=False, init_cfg=[dict(type='Kaiming', layer=['Conv2d']), dict(type='Constant', val=1, layer=['_BatchNorm', 'GroupNorm'])]):
    super(MobileNetV2, self).__init__(init_cfg)
    self.widen_factor = widen_factor
    self.out_indices = out_indices
    for index in out_indices:
        if (index not in range(0, 8)):
            raise ValueError(f'the item in out_indices must in range(0, 8). But received {index}')
    if (frozen_stages not in range((- 1), 8)):
        raise ValueError(f'frozen_stages must be in range(-1, 8). But received {frozen_stages}')
    self.out_indices = out_indices
    self.frozen_stages = frozen_stages
    self.conv_cfg = conv_cfg
    self.norm_cfg = norm_cfg
    self.act_cfg = act_cfg
    self.norm_eval = norm_eval
    self.with_cp = with_cp
    self.in_channels = make_divisible((32 * widen_factor), 8)
    if deep_stem:
        self.conv0 = ConvModule(in_channels=3, out_channels=16, kernel_size=3, stride=1, padding=1, conv_cfg=self.conv_cfg, norm_cfg=self.norm_cfg, act_cfg=self.act_cfg)
        in_channels_ = 16
    else:
        in_channels_ = 3
        self.conv0 = nn.Sequential()
    self.conv1 = ConvModule(in_channels=in_channels_, out_channels=self.in_channels, kernel_size=3, stride=2, padding=1, conv_cfg=self.conv_cfg, norm_cfg=self.norm_cfg, act_cfg=self.act_cfg)
    self.layers = []
    for (i, layer_cfg) in enumerate(self.arch_settings):
        (expand_ratio, channel, num_blocks, stride) = layer_cfg
        out_channels = make_divisible((channel * widen_factor), 8)
        inverted_res_layer = self.make_layer(out_channels=out_channels, num_blocks=num_blocks, stride=stride, expand_ratio=expand_ratio)
        layer_name = f'layer{(i + 1)}'
        self.add_module(layer_name, inverted_res_layer)
        self.layers.append(layer_name)
    if (widen_factor > 1.0):
        self.out_channel = int((1280 * widen_factor))
    else:
        self.out_channel = 1280
    layer = ConvModule(in_channels=self.in_channels, out_channels=self.out_channel, kernel_size=1, stride=1, padding=0, conv_cfg=self.conv_cfg, norm_cfg=self.norm_cfg, act_cfg=self.act_cfg)
    self.add_module('conv2', layer)
    self.layers.append('conv2')