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
71182bc1
Commit
71182bc1
authored
Dec 11, 2018
by
任广辉
Committed by
Soumith Chintala
Dec 10, 2018
Browse files
replace 'residual' with 'identity' (#679)
parent
e489abc6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
torchvision/models/resnet.py
torchvision/models/resnet.py
+6
-6
No files found.
torchvision/models/resnet.py
View file @
71182bc1
...
@@ -40,7 +40,7 @@ class BasicBlock(nn.Module):
...
@@ -40,7 +40,7 @@ class BasicBlock(nn.Module):
self
.
stride
=
stride
self
.
stride
=
stride
def
forward
(
self
,
x
):
def
forward
(
self
,
x
):
residual
=
x
identity
=
x
out
=
self
.
conv1
(
x
)
out
=
self
.
conv1
(
x
)
out
=
self
.
bn1
(
out
)
out
=
self
.
bn1
(
out
)
...
@@ -50,9 +50,9 @@ class BasicBlock(nn.Module):
...
@@ -50,9 +50,9 @@ class BasicBlock(nn.Module):
out
=
self
.
bn2
(
out
)
out
=
self
.
bn2
(
out
)
if
self
.
downsample
is
not
None
:
if
self
.
downsample
is
not
None
:
residual
=
self
.
downsample
(
x
)
identity
=
self
.
downsample
(
x
)
out
+=
residual
out
+=
identity
out
=
self
.
relu
(
out
)
out
=
self
.
relu
(
out
)
return
out
return
out
...
@@ -74,7 +74,7 @@ class Bottleneck(nn.Module):
...
@@ -74,7 +74,7 @@ class Bottleneck(nn.Module):
self
.
stride
=
stride
self
.
stride
=
stride
def
forward
(
self
,
x
):
def
forward
(
self
,
x
):
residual
=
x
identity
=
x
out
=
self
.
conv1
(
x
)
out
=
self
.
conv1
(
x
)
out
=
self
.
bn1
(
out
)
out
=
self
.
bn1
(
out
)
...
@@ -88,9 +88,9 @@ class Bottleneck(nn.Module):
...
@@ -88,9 +88,9 @@ class Bottleneck(nn.Module):
out
=
self
.
bn3
(
out
)
out
=
self
.
bn3
(
out
)
if
self
.
downsample
is
not
None
:
if
self
.
downsample
is
not
None
:
residual
=
self
.
downsample
(
x
)
identity
=
self
.
downsample
(
x
)
out
+=
residual
out
+=
identity
out
=
self
.
relu
(
out
)
out
=
self
.
relu
(
out
)
return
out
return
out
...
...
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