Skip to content

Commit

Permalink
resolve commnets
Browse files Browse the repository at this point in the history
  • Loading branch information
jshilong committed Jul 23, 2021
1 parent 586a63b commit d283f29
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mmcv/runner/base_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ def __init__(self, init_cfg=None):
# define default value of init_cfg instead of hard code
# in init_weights() function
self._is_init = False
if init_cfg:
init_cfg = copy.deepcopy(init_cfg)
self.init_cfg = init_cfg

self.init_cfg = copy.deepcopy(init_cfg)

# The `_params_init_info` is used to record the initialization
# information of the parameters
Expand Down Expand Up @@ -121,9 +120,10 @@ def init_weights(self):
logger=logger_name)
initialize(self, self.init_cfg)
if isinstance(self.init_cfg, dict):
# Avoid the parameters of the pretrained model
# are overwritten by the `init_weights`
# of the children.
# prevent the parameters of
# the pre-trained model
# from being overwritten by
# the `init_weights`
if self.init_cfg['type'] == 'Pretrained':
return

Expand Down

0 comments on commit d283f29

Please sign in to comment.