Why getting different result when finetuning from ResNet50

I am trying to train a classification model finetuning from Resnet50, but I get different result with the following different construction methods.

The performance of Method 2 is much better than Method 1. Why get such result?

Method 1

class MyResNet(nn.Module):
        def __init__(self, pretrained=True):
            super(MyResNet, self).__init__()
            self.pretrained = pretrained
            self.base = resnet50(pretrained=pretrained)
            self.classifier = nn.Linear(2048, 100)
        def forward(self, x):
            for name, module in self.base._modules.items():
                if name == 'avgpool':
                    break
                else:
                    x = module(x)
            x = F.avg_pool2d(x, x.size()[2:])
            x = x.view(x.size(0), -1)
            x = self.classifier(x)
            return x

Method 2

class MyResNet(nn.Module):
        def __init__(self, pretrained=True):
            super(MyResNet, self).__init__()
            self.pretrained = pretrained
            self.base = resnet50(pretrained=pretrained)
            self.classifier = nn.Linear(2048, 100)
        def forward(self, x):
            for name, module in self.base._modules.items():
                if name == 'avgpool':
                    break
                if name == 'layer4':
                    x = module[0](x)
                    residual = x
                    x = module[1].conv1(x)
                    x = module[1].bn1(x)
                    x = module[1].conv2(x)
                    x = module[1].bn2(x)
                    x = module[1].conv3(x)
                    x = module[1].bn3(x)
                    x += residual
                    x = module[1].relu(x)

                    residual = x
                    x = module[2].conv1(x)
                    x = module[2].bn1(x)
                    x = module[2].conv2(x)
                    x = module[2].bn2(x)
                    x = module[2].conv3(x)
                    x = module[2].bn3(x)
                    x += residual
                    x = module[2].relu(x)
                else:
                    x = module(x)
            x = F.avg_pool2d(x, x.size()[2:])
            x = x.view(x.size(0), -1)
            x = self.classifier(x)
            return x

did you ever figure this out? I haven’t checked if Method1 and Method2 are exactly equivalent, but I do suspect that maybe they are not…