Solved by ptrblck in post #2 
              
              
                Your code works. 
After running your code snippets, you can print the requires_grad attributes: 
for name, param in resnet18.named_parameters():
    print(name, param.requires_grad)

which shows, that fc.weight and fc.bias both require the gradient. 
You will also get a valid gradients in these laye…