Skip to content
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

Request to avoid loss to NaN #91

Open
u-shiori opened this issue Sep 23, 2021 · 0 comments
Open

Request to avoid loss to NaN #91

u-shiori opened this issue Sep 23, 2021 · 0 comments

Comments

@u-shiori
Copy link

u-shiori commented Sep 23, 2021

Please change the minimum value of the square root to the epsilon calculator, as shown below.

↓ Before change (current)

sine = torch.sqrt((1.0 - torch.pow(cosine, 2)).clamp(0, 1))

↓ After change

sine = torch.sqrt((1.0 - torch.pow(cosine, 2)).clamp(1e-6, 1))

The differential function of √x, 1/(2√x), becomes inf near x=0, i.e., an exploding gradient.

This results in a loss of nan as reported in #81.

So please fix it so that sqrt does not take 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant