How to take middle layers from resnet50 pretrained

Based on a previous answer from @ptrblck

You can do

list(model.layer1.children())[2].bn3

model.layer1 is an instance of nn.Sequential. Generally, to access the submodules of a sequential model you can use .children()