akamaster / pytorch_resnet_cifar10

Proper implementation of ResNet-s for CIFAR10/100 in pytorch that matches description of the original paper.
BSD 2-Clause "Simplified" License
1.22k stars 335 forks source link

an issue about resnet implementation #23

Closed tccfree closed 3 years ago

tccfree commented 4 years ago

In your resnet.py file, the forward function of BasicBlock calss returns the relu of the sum of shortcut and the out variable, but shouldn't it return the sum of the shortcut and relu of the out variable? something like this : def forward(self, x): out = F.relu(self.bn1(self.conv1(x))) out = F.relu(self.bn2(self.conv2(out))) out += self.shortcut(x) return out

PerloDaniele commented 4 years ago

Nope, this is the paper baseline architecture, just look Figure 5 on the paper.

tccfree commented 4 years ago

Nope, this is the paper baseline architecture, just look Figure 5 on the paper.

You are right, it is the baseline. Actually Kaiming He discussed these two different residual units in another paper《Identity Mappings in Deep Residual Networks》.