Skip to content

Commit

Permalink
Remove unnecessary relu in ResNet
Browse files Browse the repository at this point in the history
  • Loading branch information
kuangliu committed May 3, 2017
1 parent 1a4bac9 commit 9c40489
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions models/resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def __init__(self, in_planes, planes, stride=1):

def forward(self, x):
out = F.relu(self.bn1(self.conv1(x)))
out = F.relu(self.bn2(self.conv2(out)))
out += self.shortcut(x) if self.shortcut else x
out = self.bn2(self.conv2(out))
out += self.shortcut(x)
out = F.relu(out)
return out

Expand Down Expand Up @@ -58,7 +58,7 @@ def forward(self, x):
out = F.relu(self.bn1(self.conv1(x)))
out = F.relu(self.bn2(self.conv2(out)))
out = self.bn3(self.conv3(out))
out += self.shortcut(x) if self.shortcut else x
out += self.shortcut(x)
out = F.relu(out)
return out

Expand Down

0 comments on commit 9c40489

Please sign in to comment.