I am using a pretrained resnet101 and I want to change the dilation rates and stride of some conv layers.
If I initialize the layers again, that will change the weights of that layer, but incase of stride or dilation rate change only, the weights should not get changed because the kernel size is same.
So how can I change the layer configuration without changing the weights keeping the kernel size same.
Currently, This is what I am doing, but it changes the weights.
self.resnet = torchvision.models.resnet101(pretrained=True)
for i in range(23):
self.resnet.layer3[i].conv2 = nn.Conv2d(256, 256,
kernel_size=3,
stride=1,
padding=2,
dilation=2,
bias=False)