basenet icon indicating copy to clipboard operation
basenet copied to clipboard

Order of computations in ResNet blocks

Open Paandaman opened this issue 5 years ago • 0 comments

https://github.com/bkj/basenet/blob/c61f558c7bd6341dcc1610135553c96bd7d2ca5b/examples/cifar/cifar10.py#L118-L122

What is the motivation behind computing the batch norm and relu before sending the data into the convolutional layer?

In the implementation done by https://github.com/kuangliu/pytorch-cifar, the computation is done in the following order which seems more conventional, so I am curious why it is changed!

out = F.relu(self.bn1(self.conv1(x))) out = self.bn2(self.conv2(out)) shortcut = self.shortcut(x) if hasattr(self, 'shortcut') else x out += shortcut out = F.relu(out)

Paandaman avatar Sep 05 '19 01:09 Paandaman