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
3ae1b257
Unverified
Commit
3ae1b257
authored
Apr 02, 2021
by
Wenwei Zhang
Committed by
GitHub
Apr 02, 2021
Browse files
fix initialization bug of override cfg (#918)
parent
9d80f56a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
mmcv/cnn/utils/weight_init.py
mmcv/cnn/utils/weight_init.py
+10
-4
No files found.
mmcv/cnn/utils/weight_init.py
View file @
3ae1b257
# Copyright (c) Open-MMLab. All rights reserved.
# Copyright (c) Open-MMLab. All rights reserved.
import
copy
import
warnings
import
warnings
import
numpy
as
np
import
numpy
as
np
...
@@ -445,12 +446,17 @@ def initialize(module, init_cfg):
...
@@ -445,12 +446,17 @@ def initialize(module, init_cfg):
init_cfg
=
[
init_cfg
]
init_cfg
=
[
init_cfg
]
for
cfg
in
init_cfg
:
for
cfg
in
init_cfg
:
override
=
cfg
.
pop
(
'override'
,
None
)
# should deeply copy the original config because cfg may be used by
_initialize
(
module
,
cfg
)
# other modules, e.g., one init_cfg shared by multiple bottleneck
# blocks, the expected cfg will be changed after pop and will change
# the initialization behavior of other modules
cp_cfg
=
copy
.
deepcopy
(
cfg
)
override
=
cp_cfg
.
pop
(
'override'
,
None
)
_initialize
(
module
,
cp_cfg
)
if
override
is
not
None
:
if
override
is
not
None
:
cfg
.
pop
(
'layer'
,
None
)
cp_
cfg
.
pop
(
'layer'
,
None
)
_initialize_override
(
module
,
override
,
cfg
)
_initialize_override
(
module
,
override
,
cp_
cfg
)
else
:
else
:
# All attributes in module have same initialization.
# All attributes in module have same initialization.
pass
pass
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