Solved by ptrblck in post #2 
              
              
                If you want to change the first layer, you can directly replace it via: 
model = torchvision.models.resnet34(pretrained=False)
model.conv1 = nn.Conv2d(1, 64, (7, 7), (2, 2), (3, 3), bias=False)

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

I’m not sure what might go wrong in your code, as it’s a …