I was doing  total_loss += loss.detach() after  optimizer.step()  but now I use a closure.
How can I have access access to the loss now?
I use the  total_loss  to know when to stop the learning process.