Torch C++: API to check NAN
I am using libtorch C++. In python version we can easily check the value of a tensor by calling its numpy value, and in numpy we have np.isnan(). I was wondering if there is a built in function in libtorch C++ to check whether a tensor has any NAN value? 

Thanks,
Afshin

Adding on to Fábio's answer (my reputation is too low to comment):

If you actually want to use the information about NANs in an assert or if condition you need convert it from a torch::Tensor to a C++ bool like so

torch::Tensor myTensor;
// do something
auto tensorIsNan = at::isnan(myTensor).any().item&lt;bool&gt;(); // will be of type bool

