Solved by sidd2006 in post #3 
              
              
                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_laye…