From ac48f106cf157d7094a177abaf696c6ee3867ce5 Mon Sep 17 00:00:00 2001 From: Anton Nikishin Date: Tue, 7 Apr 2020 15:05:52 +0300 Subject: [PATCH] Update resnet.py The basic block of ResNet is corrected in case of expansion rate different from one. --- models/resnet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/resnet.py b/models/resnet.py index f01cd8021..83ec95c6a 100644 --- a/models/resnet.py +++ b/models/resnet.py @@ -18,8 +18,8 @@ def __init__(self, in_planes, planes, stride=1): super(BasicBlock, self).__init__() self.conv1 = nn.Conv2d(in_planes, planes, kernel_size=3, stride=stride, padding=1, bias=False) self.bn1 = nn.BatchNorm2d(planes) - self.conv2 = nn.Conv2d(planes, planes, kernel_size=3, stride=1, padding=1, bias=False) - self.bn2 = nn.BatchNorm2d(planes) + self.conv2 = nn.Conv2d(planes, self.expansion*planes, kernel_size=3, stride=1, padding=1, bias=False) + self.bn2 = nn.BatchNorm2d(self.expansion*planes) self.shortcut = nn.Sequential() if stride != 1 or in_planes != self.expansion*planes: