MCPcopy Create free account
hub / github.com/open-mmlab/mmengine / __init__

Method __init__

mmengine/model/base_module.py:39–56  ·  view source on GitHub ↗

Initialize BaseModule, inherited from `torch.nn.Module`

(self, init_cfg: Union[dict, List[dict], None] = None)

Source from the content-addressed store, hash-verified

37 """
38
39 def __init__(self, init_cfg: Union[dict, List[dict], None] = None):
40 """Initialize BaseModule, inherited from `torch.nn.Module`"""
41
42 # NOTE init_cfg can be defined in different levels, but init_cfg
43 # in low levels has a higher priority.
44
45 super().__init__()
46 # define default value of init_cfg instead of hard code
47 # in init_weights() function
48 self._is_init = False
49
50 self.init_cfg = copy.deepcopy(init_cfg)
51
52 # Backward compatibility in derived classes
53 # if pretrained is not None:
54 # warnings.warn('DeprecationWarning: pretrained is a deprecated \
55 # key, please consider using init_cfg')
56 # self.init_cfg = dict(type='Pretrained', checkpoint=pretrained)
57
58 @property
59 def is_init(self):

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected