Thank you. This is what I was looking for.
At line 95 in potfit.py you have:
output0.sum().backward(retain_graph=True, create_graph=True)
why the  .sum() is needed?



 Tony-Y:

https://github.com/Tony-Y/PotFit
This is my example that employs the derivative error as well as the MSE.