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
50d2cbdd
Commit
50d2cbdd
authored
Dec 12, 2019
by
Zhipeng Han
Committed by
Kai Chen
Dec 12, 2019
Browse files
process the case that no weight in the module (#153)
Signed-off-by:
han_hans
<
han_hans@apple.com
>
parent
0eef3757
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
mmcv/cnn/weight_init.py
mmcv/cnn/weight_init.py
+2
-1
No files found.
mmcv/cnn/weight_init.py
View file @
50d2cbdd
...
@@ -2,6 +2,7 @@ import torch.nn as nn
...
@@ -2,6 +2,7 @@ import torch.nn as nn
def
constant_init
(
module
,
val
,
bias
=
0
):
def
constant_init
(
module
,
val
,
bias
=
0
):
if
hasattr
(
module
,
'weight'
)
and
module
.
weight
is
not
None
:
nn
.
init
.
constant_
(
module
.
weight
,
val
)
nn
.
init
.
constant_
(
module
.
weight
,
val
)
if
hasattr
(
module
,
'bias'
)
and
module
.
bias
is
not
None
:
if
hasattr
(
module
,
'bias'
)
and
module
.
bias
is
not
None
:
nn
.
init
.
constant_
(
module
.
bias
,
bias
)
nn
.
init
.
constant_
(
module
.
bias
,
bias
)
...
...
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