How to remove some output from the last layer

Hi,

I want to remove some of the ouputs from last layer of a pretrained pytorch model (lets say ResNet50). I want to keep the pretrained weights and biases in-tact but just want to create a new model that has an output of lets say (batch, 300) rather than (batch, 1000)

Thank You.

The Interning Tutorial gives you some information about changing the last layer to fit your use case.
Basically you would have to replace e.g. model.fc with a new linear layer.