Hello,
I have a question about how autograd handles Nans,
a = torch.tensor([np.nan, 2])
param = torch.tensor([1.], requires_grad=True)

(a * param)[1].backward()
print(param.grad) # yields tensor([nan])

I was expecting it to return tensor([2]) since param grad is independent of the a[0]
Is this normal behavior ? Is there a way to force autograd to ignore nan if the grad is independent of that value ?
Thank you for your answer.