model.fc and model.classifier are just the internal names for some submodules.
If you print the model, you’ll find the name of the last layer, which you could replace with a custom one for your use case:
model = models.densenet121()
print(model)

In this example, the densenet121 uses the attribute name classifier for the last nn.Linear layer, so you should use this attribute name.
If you just assign a custom linear layer to model.fc it won’t be used and trained without changing the forward method.