mobius:

self._modules[‘fc1’]


Thanks Mobius. Your pointer actually made me think a little more and I ended up doing it much for simply.
num_classes_in_new_model = 5
new_model = copy.deepcopy(old_model)
in_features_last_layer = new_model.__getattr__('fc2').in_features
new_model.__setattr__('fc2', nn.Linear(in_features_last_layer, num_classes_in_new_model))
   

I do not need a new class then and I checked it works fine. Thanks again.