Hello, I’m trying to implement custom optimizers, then need to get values of objective functions. As far as I understand, suppose f(x) is an objective function,


p.data is x


p.grad.data is the gradient of f at x


where
for group in self.param_groups:
    for p in group['params']:
         pass

Is there any good way to get the value f(x) from optimizer? Thank you.