Muhammad4hmed:

So the model is supposed to give 25 outputs ( n x 25 ) right?


Unfortunately that’s not the case, since changing the out_features alone won’t reinitialize the internal parameters. You would have to reassign a new nn.Linear layer to self.vgg.classifier[-1] instead.