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
de4f14e9
"src/torio/git@developer.sourcefind.cn:OpenDAS/torchaudio.git" did not exist on "09887246bb60d3fe5c2032fb8884d6b32ecf5241"
Unverified
Commit
de4f14e9
authored
Apr 18, 2021
by
ZhangShilong
Committed by
GitHub
Apr 18, 2021
Browse files
[Enhancement]: refactor init cfg (#958)
parent
5504b5fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
mmcv/runner/base_module.py
mmcv/runner/base_module.py
+3
-4
No files found.
mmcv/runner/base_module.py
View file @
de4f14e9
...
...
@@ -22,8 +22,7 @@ class BaseModule(nn.Module, metaclass=ABCMeta):
# define default value of init_cfg instead of hard code
# in init_weigt() function
self
.
_is_init
=
False
if
init_cfg
is
not
None
:
self
.
init_cfg
=
init_cfg
self
.
init_cfg
=
init_cfg
# Backward compatibility in derived classes
# if pretrained is not None:
...
...
@@ -40,7 +39,7 @@ class BaseModule(nn.Module, metaclass=ABCMeta):
from
..cnn
import
initialize
if
not
self
.
_is_init
:
if
hasattr
(
self
,
'
init_cfg
'
)
:
if
self
.
init_cfg
:
initialize
(
self
,
self
.
init_cfg
)
for
m
in
self
.
children
():
if
hasattr
(
m
,
'init_weight'
):
...
...
@@ -52,7 +51,7 @@ class BaseModule(nn.Module, metaclass=ABCMeta):
def
__repr__
(
self
):
s
=
super
().
__repr__
()
if
hasattr
(
self
,
'
init_cfg
'
)
:
if
self
.
init_cfg
:
s
+=
f
'
\n
init_cfg=
{
self
.
init_cfg
}
'
return
s
...
...
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