I want to modify the parameters of all nn.Conv2d layers in a model. Specifically, i want to change the kernel_size from (X,Y) to (X,3), padding from (X//2, Y//2) to (X//2,1), stride from (SX,SY) to (SX, 1), and of course the weight tensor to be modified accordingly.
I started doing something like:
for name, module in net.named_modules():
    if isinstance(module, nn.Conv2d):
        stride = list(module.stride)
        stride[1] = 1
        module.stride = tuple(stride)

Then I was about to change module.weight then i realised that there is a lot of initialisation that is taken care of in the constructor of the layer. So really, rather than modifying the internals of the layer, i should be reconstructing a new one fresh. How do i do this?
The reason why i want to do this is because i want to do something like:
import timm
net = timm.create_model("resnet50")
...adapt conv2d layers here...