I am implementing improved Rprop with weight backtracking and I would like to follow the standard way of PyTorch to do so. I see that a closure function can be used inside the step function of an optimizer class to get access to the loss. However, I have no need to calculate the gradients again, I just want to have access to the loss value. Is there anyway to do that other than passing the loss as an argument in the step function?