InvertedResidual¶
- class mmpretrain.models.utils.InvertedResidual(in_channels, out_channels, mid_channels, kernel_size=3, stride=1, se_cfg=None, conv_cfg=None, norm_cfg={'type': 'BN'}, act_cfg={'type': 'ReLU'}, drop_path_rate=0.0, with_cp=False, init_cfg=None)[源代码]¶
Inverted Residual Block.
- 参数:
in_channels (int) – The input channels of this module.
out_channels (int) – The output channels of this module.
mid_channels (int) – The input channels of the depthwise convolution.
kernel_size (int) – The kernel size of the depthwise convolution. Defaults to 3.
stride (int) – The stride of the depthwise convolution. Defaults to 1.
se_cfg (dict, optional) – Config dict for se layer. Defaults to None, which means no se layer.
conv_cfg (dict) – Config dict for convolution layer. Defaults to None, which means using conv2d.
norm_cfg (dict) – Config dict for normalization layer. Defaults to
dict(type='BN')
.act_cfg (dict) – Config dict for activation layer. Defaults to
dict(type='ReLU')
.drop_path_rate (float) – stochastic depth rate. Defaults to 0.
with_cp (bool) – Use checkpoint or not. Using checkpoint will save some memory while slowing down the training speed. Defaults to False.
init_cfg (dict | list[dict], optional) – Initialization config dict.
- forward(x)[源代码]¶
Forward function.
- 参数:
x (torch.Tensor) – The input tensor.
- 返回:
The output tensor.
- 返回类型: