Given:
model = torchvision.models.resnet18(pretrained=True)

I am interested in making the following changes to the network:


Truncate the network after the second layer, which in Pytorch is called “layer2”.


Change the stride and padding of some the convolution layers.


As for 1 - will the following solution make “model2” inherit all the residual shortcuts of the first layers of resnset? (EDIT: it seems like the answer it “yes” but I will still be glad to know if it indeed makes sense)
first = model.conv1
second  = model.bn1
…
First_block = list(model.layer1.children() ) 
Second_block = list(model.layer2.children() ) 
…
Concat_list = First_block
Concat_list.extend(Second_block)
…

model = nn.Sequential(first,second,...,*Concat_list) 

(I used “…” to signify similar implementation for the other network components, such as “bn1” and “maxpool”).
As for 2 -
How can I access and change the stride and padding of some of the convolution layers? for example - the ones in model.layer1? [EDIT: I think that something like “model.layer1[0].conv2.stride = …” will do it.)
Thanks in advance