It seems pytorch does have/expose the finfo
link, but I can't find it in libtorch
. Is it even made available in libtorch yet or not? Using the torch.finfo I could easily do:
esp = torch.finfo(torch.float).eps
which I believe is the counterpart/equivalent of np.spacing(1)
but in libtorch I can't do the same thing as I can not find any trace of finfo
class. What should I do?
It turns out, we can simply use std::nextafter
just fine. And also torch::nextafter
is recently added (#42580) and uses this under the hood!
So if you don't use nighlybuilds, and until 1.7 ships, you can simply use std::nextafter
just fine! Concerning the THPFinfo
:
THPFInfo and THPFInfo_eps exist to make this information available in python