Unverified Commit 00870b9c authored by Miao Zheng's avatar Miao Zheng Committed by GitHub
Browse files

[Refactoring] Revise function of is_init flag in BaseModule (#898)

parent 967d9d58
......@@ -40,14 +40,12 @@ class BaseModule(nn.Module, metaclass=ABCMeta):
from ..cnn import initialize
if not self._is_init:
if hasattr(self, 'init_cfg'):
initialize(self, self.init_cfg)
self._is_init = True
for module in self.children():
if 'init_weight' in dir(module):
module.init_weight()
self._is_init = True
else:
warnings.warn('This module has bee initialized, \
please call initialize(module, init_cfg) to reinitialize it')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment