Solved by KFrank in post #2 
              
              
                Hi Lavish! 

If it were me, I would probably do: 
for i in range(23):
    saveWeight = self.resnet.layer3[i].conv2
    self.resnet.layer3[i].conv2 = nn.Conv2d (256, 256,
                                            kernel_size=3,
                                            stride=1, 
                …