Saving some feature maps to be feed to another model

Hi, I am trying to use a pretrained model (Resnet for example, by removing the last 2 layers and adding a 1*1 conv to get the desired shaped output ) this output will be used as input for another model.

How can I get the output of the new model.

This is the original model:

model = models.resnet152(pretrained=True)

the new model is

newmodel = torch.nn.Sequential(*(list(model.children())[:-2]))

newmodel.add_module(“convlast”,nn.Conv2d(2048, 64, 1))

I’m not sure, if you are seeing any errors, but wouldn’t a vanilla forward pass work?

output = newmodel(input)

output = other_model(output)