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
da071146
You need to sign in or sign up before continuing.
Unverified
Commit
da071146
authored
May 13, 2021
by
Shilong Zhang
Committed by
GitHub
May 13, 2021
Browse files
[Fix]: fix basemodule (#1018)
* fix basemodule * add commnet
parent
4c2b05f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
mmcv/runner/base_module.py
mmcv/runner/base_module.py
+9
-0
No files found.
mmcv/runner/base_module.py
View file @
da071146
...
...
@@ -4,6 +4,8 @@ from abc import ABCMeta
import
torch.nn
as
nn
from
mmcv
import
ConfigDict
class
BaseModule
(
nn
.
Module
,
metaclass
=
ABCMeta
):
"""Base module for all modules in openmmlab."""
...
...
@@ -41,6 +43,13 @@ class BaseModule(nn.Module, metaclass=ABCMeta):
if
not
self
.
_is_init
:
if
self
.
init_cfg
:
initialize
(
self
,
self
.
init_cfg
)
if
isinstance
(
self
.
init_cfg
,
(
dict
,
ConfigDict
)):
# Avoid the parameters of the pre-training model
# being overwritten by the init_weights
# of the children.
if
self
.
init_cfg
[
'type'
]
==
'Pretrained'
:
return
for
m
in
self
.
children
():
if
hasattr
(
m
,
'init_weights'
):
m
.
init_weights
()
...
...
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