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 suffered gradient explosion in my training process. I used with autograd.detect_anomaly() and got the hint Function 'SqrtBackward0' returned nan values in its 0th output. However, I didn't use functions like torch.sqrt() in my code, so I thought the bug may lie in the internal calculations of Theseus. And I have noticed this #661 relevant fix, so I checked the implementation of to_quarternion() function in so3.py.
I found the eps in the calculation of sine_half_theta, the relevant code is:
🐛 Bug
I suffered gradient explosion in my training process. I used
with autograd.detect_anomaly()
and got the hintFunction 'SqrtBackward0' returned nan values in its 0th output.
However, I didn't use functions liketorch.sqrt()
in my code, so I thought the bug may lie in the internal calculations of Theseus. And I have noticed this #661 relevant fix, so I checked the implementation ofto_quarternion()
function inso3.py
.I found the eps in the calculation of
sine_half_theta
, the relevant code is:However, another use of
sqrt
lies in the calculation ofw
:here it just limits the result between 0 and 4, when it is close to 0, the backward process may fail.
Steps to Reproduce
I prepare a simple test code to reproduce this bug:
The output will be
And if I add an eps(which is 1e-6 in my test) in the calculation of
w
:The grad will be:
System Info
The text was updated successfully, but these errors were encountered: