From 11e6b54d360023a230a6aa271390a324e8384a98 Mon Sep 17 00:00:00 2001 From: Charles Pao <32415549+Dirtybluer@users.noreply.github.com> Date: Mon, 16 Mar 2020 19:14:57 +0800 Subject: [PATCH] add comments for the modified implementation of ResNet (#1983) Co-authored-by: Charles Pao --- torchvision/models/resnet.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/torchvision/models/resnet.py b/torchvision/models/resnet.py index 527eab8ff05..f0c3836e267 100644 --- a/torchvision/models/resnet.py +++ b/torchvision/models/resnet.py @@ -74,6 +74,12 @@ def forward(self, x): class Bottleneck(nn.Module): + # Bottleneck in torchvision places the stride for downsampling at 3x3 convolution(self.conv2) + # while original implementation places the stride at the first 1x1 convolution(self.conv1) + # according to "Deep residual learning for image recognition"https://arxiv.org/abs/1512.03385. + # This variant is also known as ResNet V1.5 and improves accuracy according to + # https://ngc.nvidia.com/catalog/model-scripts/nvidia:resnet_50_v1_5_for_pytorch. + expansion = 4 __constants__ = ['downsample']