Shortcuts

Note

You are reading the documentation for MMClassification 0.x, which will soon be deprecated at the end of 2022. We recommend you upgrade to MMClassification 1.0 to enjoy fruitful new features and better performance brought by OpenMMLab 2.0. Check the installation tutorial, migration tutorial and changelog for more details.

InvertedResidual

class mmcls.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)[source]

Inverted Residual Block.

Parameters
  • 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)[source]

Forward function.

Parameters

x (torch.Tensor) – The input tensor.

Returns

The output tensor.

Return type

torch.Tensor

Read the Docs v: latest
Versions
master
latest
1.x
dev-1.x
Downloads
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.