Got nan in torch.reverse()

when i was running code as follow:

cam_coords = pixel2cam(depth.squeeze(1), intrinsics.inverse())

The second parameter of pixel2cam(depth.squeeze(1), intrinsics.inverse()) contains nan,
then i added this code before it:

    if torch.any(torch.isnan(intrinsics.inverse())):
        print(intrinsics)
        print(intrinsics.inverse())
        print(torch.isnan(intrinsics.inverse()))
        print(torch.any(torch.isnan(intrinsics.inverse())))

and got output as follow:


This result seems contradictory. After it enter the if torch.any(torch.isnan(intrinsics.inverse())): why does print(torch.any(torch.isnan(intrinsics.inverse()))) output False. In addition, the output of print(intrinsics.inverse()) does not contain nan.
How does this happen?

Hi WBSUN,

I do not see any explanation from reading your code. Would you please post a complete working example that reproduces the issue? I will be happy to test it.
:slightly_smiling_face:

Thx for reply! My code is kind of complex, I will try to simplify the code and post here!