Commit 71182bc1 authored by 任广辉's avatar 任广辉 Committed by Soumith Chintala
Browse files

replace 'residual' with 'identity' (#679)

parent e489abc6
...@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment