Yeah.
Thats one way to do it. With only_intputs = True, it is possible to compute param0 only.
Should I also set retain_graph = True for the optimizer to step?
Is there any difference between using .grad() and .backward() except that  .grad() returns the gradients?