BaseModule — mmengine 0.10.7 documentation (original) (raw)
class mmengine.model.BaseModule(init_cfg=None)[source]¶
Base module for all modules in openmmlab. BaseModule
is a wrapper oftorch.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 theinit_weights
.
Note
PretrainedInit has a higher priority than any other initializer. The loaded pretrained weights will overwrite the previous initialized weights.
Parameters:
init_cfg (dict or List _[_dict] , optional) – Initialization config dict.
Initialize the weights.