Which line of code raises this error?
I’m able to load the pretrained model and manipulate the layers as you did:
model = models.densenet201(pretrained=True)
model.features[0] = nn.Conv2d(1, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
model.classifier = nn.Linear(1920, 264)

out = model(torch.randn(1, 1, 224, 224))

If this error is raised during the manual loading of the state_dict, where does this state_dict come from?