Shortcuts

mmcv.cnn.build_norm_layer

mmcv.cnn.build_norm_layer(cfg: Dict, num_features: int, postfix: int | str = '') Tuple[str, Module][source]

Build normalization layer.

Parameters:
  • cfg (dict) –

    The norm layer config, which should contain:

    • type (str): Layer type.

    • layer args: Args needed to instantiate a norm layer.

    • requires_grad (bool, optional): Whether stop gradient updates.

  • num_features (int) – Number of input channels.

  • postfix (int | str) – The postfix to be appended into norm abbreviation to create named layer.

Returns:

The first element is the layer name consisting of abbreviation and postfix, e.g., bn1, gn. The second element is the created norm layer.

Return type:

tuple[str, nn.Module]