The “gradient” of a variable says how much it would change, if you perturbed the variable that you computed the backwards from (d_loss) in this case. d_loss doesn’t have any gradient; it’s the parameters that fed into it that get gradients.
The optimizer is able to find the gradients because it loops over the parameters of the module you are optimizing, which are defined to be the parameters that are accumulating gradients.