hjmshi / PyTorch-LBFGS

A PyTorch implementation of L-BFGS.
MIT License
586 stars 67 forks source link

RuntimeError: Expected object of type torch.FloatTensor but found type torch.DoubleTensor for argument #3 'other' #14

Open jihaonew opened 5 years ago

jihaonew commented 5 years ago

The error occurs in functions/LBFGS.py, line 854. I think this error comes from t. It becomes a double precision number with the process of convergence. I tried

if(F_new > F_k + (c1*t*gtd).float()):

or

if(F_new.double() > F_k.double() + (c1*t*gtd)):

However, if I do so, the loss will not decrease any more.

hjmshi commented 5 years ago

Thanks! Let me look into it. Is this with a particular network or problem that you are looking at?

jihaonew commented 5 years ago

I working on a non-linear least squares problem with highly-dense Jacobian.