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
vision
Commits
0f971f64
"git@developer.sourcefind.cn:OpenDAS/vision.git" did not exist on "32e16805a17401f5ef5ec825c808d645f5c26509"
Unverified
Commit
0f971f64
authored
May 25, 2022
by
YosuaMichael
Committed by
GitHub
May 25, 2022
Browse files
Fix bug by checking if norm_layer weight is None before init (#6082)
parent
7b28442b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
torchvision/models/resnet.py
torchvision/models/resnet.py
+2
-2
No files found.
torchvision/models/resnet.py
View file @
0f971f64
...
@@ -217,9 +217,9 @@ class ResNet(nn.Module):
...
@@ -217,9 +217,9 @@ class ResNet(nn.Module):
# This improves the model by 0.2~0.3% according to https://arxiv.org/abs/1706.02677
# This improves the model by 0.2~0.3% according to https://arxiv.org/abs/1706.02677
if
zero_init_residual
:
if
zero_init_residual
:
for
m
in
self
.
modules
():
for
m
in
self
.
modules
():
if
isinstance
(
m
,
Bottleneck
):
if
isinstance
(
m
,
Bottleneck
)
and
m
.
bn3
.
weight
is
not
None
:
nn
.
init
.
constant_
(
m
.
bn3
.
weight
,
0
)
# type: ignore[arg-type]
nn
.
init
.
constant_
(
m
.
bn3
.
weight
,
0
)
# type: ignore[arg-type]
elif
isinstance
(
m
,
BasicBlock
):
elif
isinstance
(
m
,
BasicBlock
)
and
m
.
bn2
.
weight
is
not
None
:
nn
.
init
.
constant_
(
m
.
bn2
.
weight
,
0
)
# type: ignore[arg-type]
nn
.
init
.
constant_
(
m
.
bn2
.
weight
,
0
)
# type: ignore[arg-type]
def
_make_layer
(
def
_make_layer
(
...
...
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