Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
MMCV
Commits
00870b9c
Unverified
Commit
00870b9c
authored
Mar 18, 2021
by
Miao Zheng
Committed by
GitHub
Mar 18, 2021
Browse files
[Refactoring] Revise function of is_init flag in BaseModule (#898)
parent
967d9d58
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
3 deletions
+1
-3
mmcv/runner/base_module.py
mmcv/runner/base_module.py
+1
-3
No files found.
mmcv/runner/base_module.py
View file @
00870b9c
...
@@ -40,14 +40,12 @@ class BaseModule(nn.Module, metaclass=ABCMeta):
...
@@ -40,14 +40,12 @@ class BaseModule(nn.Module, metaclass=ABCMeta):
from
..cnn
import
initialize
from
..cnn
import
initialize
if
not
self
.
_is_init
:
if
not
self
.
_is_init
:
if
hasattr
(
self
,
'init_cfg'
):
if
hasattr
(
self
,
'init_cfg'
):
initialize
(
self
,
self
.
init_cfg
)
initialize
(
self
,
self
.
init_cfg
)
self
.
_is_init
=
True
for
module
in
self
.
children
():
for
module
in
self
.
children
():
if
'init_weight'
in
dir
(
module
):
if
'init_weight'
in
dir
(
module
):
module
.
init_weight
()
module
.
init_weight
()
self
.
_is_init
=
True
else
:
else
:
warnings
.
warn
(
'This module has bee initialized,
\
warnings
.
warn
(
'This module has bee initialized,
\
please call initialize(module, init_cfg) to reinitialize it'
)
please call initialize(module, init_cfg) to reinitialize it'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment