I want to use Resnet model with pre-trained weights, but I want to use additional residual  block (layer 5)  before the last FC layer is this the right way to do that:
ResNet_upd = torchvision.models.resnet18(prertained= True)
MyModel = nn.Sequential()
MyModel.add_module(“conv1”, list(ResNet_upd .children())[0])
MyModel.add_module(“bn1”, list(ResNet_upd .children())[1])
MyModel.add_module(“relu”, list(ResNet_upd .children())[2])
MyModel.add_module(“maxpool”, list(ResNet_upd .children())[3])
MyModel.add_module(“layer1”, list(ResNet_upd .children())[4])
MyModel.add_module(“layer2”, list(ResNet_upd .children())[5])
MyModel.add_module(“layer3”, list(ResNet_upd .children())[6])
MyModel.add_module(“layer4”, list(ResNet_upd .children())[7])
MyModel.add_module(“layer5”,nn.Sequential(*resnet_block(512, 512, 1, first_block=True)))
MyModel.add_module(“avgpool”, nn.AdaptiveAvgPool2d((1, 1)))
MyModel.add_module(“fc”, nn.Linear(512, 937))
print(MyModel)