You don’t access it, but pass it. But you need to pass torch::nullopt for the gradient:
loss.backward(torch::nullopt, /*keep_graph=*/ True, /*create_graph=*/ False);

In your example, a better solution would be to detach_() the desired_out, though.
Best regards
Thomas