You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got RuntimeError: Function 'SqrtBackward0' returned nan values in its 0th output
in feats0[kk], feats1[kk] = lpips.normalize_tensor(outs0[kk]), lpips.normalize_tensor(outs1[kk])
It seems that this issue might be solved by changing
Thanks for posting this. I've been struggling to figure out what's the 'SqrtBackward0' issue and how to fix it. Perhaps, zero output causes numerical instability in the back prop in torch.sqrt!
Perhaps better option is to fix the torch.sqrt function, as in my case I'm directly using a torch.sqrt in my model.
Hi,
I got RuntimeError: Function 'SqrtBackward0' returned nan values in its 0th output
in feats0[kk], feats1[kk] = lpips.normalize_tensor(outs0[kk]), lpips.normalize_tensor(outs1[kk])
It seems that this issue might be solved by changing
PerceptualSimilarity/lpips/__init__.py
Line 14 in 31bc127
to
norm_factor = torch.sqrt(torch.sum(in_feat**2,dim=1,keepdim=True) + eps)
The text was updated successfully, but these errors were encountered: