Hi,
From reading that paragraph, I don’t think (2) defines a loss. It is just an inequality.
In general, if you want the gradients for your parameters wrt your loss in a differentiable manner (to be able to compute gradient wrt to these gradients), you can do:
grads = autograd.grad(loss, model.parameters(), create_graph=True).