Thanks for your timely response.
What is the meaning of " the loss is linear in a parameter and thus the first gradient does not depend on it"?
Do you mean that, assuming y = 2x, d(dy/dx)/dx = 0? But why does PyTorch just set the gradient to 0?