From d283f296f7ce9f53bd53a2d9a4ed21026491fd20 Mon Sep 17 00:00:00 2001 From: zhangshilong <2392587229zsl@gmail.com> Date: Fri, 23 Jul 2021 13:59:39 +0800 Subject: [PATCH] resolve commnets --- mmcv/runner/base_module.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mmcv/runner/base_module.py b/mmcv/runner/base_module.py index 1c6a89b161..ac2d7fcaaf 100644 --- a/mmcv/runner/base_module.py +++ b/mmcv/runner/base_module.py @@ -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 @@ -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