This worked for me: I was trying to use greyscale image.
vgg16 = models.vgg16_bn(pretrained=True)
for param in vgg16.parameters():
param.requires_grad = False
layers = list(vgg16.features.children())[:-1]
layers[0] = nn.Conv2d(1, 64, kernel_size=3, stride=1, padding=1)
features = nn.Sequential(*layers).cuda()