-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError: Function 'SqrtBackward0' returned nan values in its 0th output #121
Comments
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 |
Facing the same issue. @Can-Zhao Did adding EPS solve the issue ? Is there a proposed PR for this ? Should I make one ? |
Hello, I faced same problem and fixed by changing to |
It's a big problem, has impact to other libs @richzhang |
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: