Shortcuts

BaseModule

class mmengine.model.BaseModule(init_cfg=None)[源代码]

Base module for all modules in openmmlab. BaseModule is a wrapper of torch.nn.Module with additional functionality of parameter initialization. Compared with torch.nn.Module, BaseModule mainly adds three attributes.

  • init_cfg: the config to control the initialization.

  • init_weights: The function of parameter initialization and recording initialization information.

  • _params_init_info: Used to track the parameter initialization information. This attribute only exists during executing the init_weights.

备注

PretrainedInit has a higher priority than any other initializer. The loaded pretrained weights will overwrite the previous initialized weights.

参数:

init_cfg (dict or List[dict], optional) – Initialization config dict.

init_weights()[源代码]

Initialize the weights.