That’s strange.
Could you just run your code with my dummy input:
resnet18 = models.resnet18()
resnet18.conv1 = torch.nn.Conv2d(1, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
resnet18.fc = = torch.nn.Linear(512, 1)
x = torch.randn(64, 1, 224, 224)
output = resnet18(x)