Add custom Layer in the middle of torchvision model

Hi,
I have created a resnet model from torchvision like this:
model = torchvision.models.resnet101(pretrained=pre_trained)
Now i want to create a custom layer say conv layer, just after max_pool as indicated in the picture

To be precise, i want to replace the batch norm layer with a custom metadatanorm as indicated in the paper: “https://arxiv.org/pdf/2104.09052.pdf

You could replace the layer with an nn.Sequential block containing the original layer as well as your new layer as described here.