Hi,
The problem comes with the way of constructing the new model. Please use the following code snippet. It will work.
import torch.nn as nn
import torch

model = torch.hub.load('pytorch/vision:v0.6.0', 'densenet121', pretrained=True)
n_model = nn.Sequential(model,
                    nn.Linear(model.classifier.out_features, 100))
x = torch.ones((1,3, 224, 224))
out = n_model(x)
print(out.shape)

Thanks