how to count numbers of nan in tensor pytorch
I used to use
assert torch.isnan(myTensor.view(-1)).sum().item()==0

to count whether if there is some nan in my tensor. But I found this way inefficient and may be wrong
Is there any better solution? THx