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

NAN source? #155

Open
caoxu915683474 opened this issue Dec 17, 2019 · 1 comment
Open

NAN source? #155

caoxu915683474 opened this issue Dec 17, 2019 · 1 comment

Comments

@caoxu915683474
Copy link

return attn_dist / tf.reshape(masked_sums, [-1, 1]) # re-normalize

@caoxu915683474
Copy link
Author

return attn_dist / (tf.reshape(masked_sums, [-1, 1]) + tf.ones_like(tf.reshape(masked_sums, [-1, 1])) * sys.float_info.epsilon)

tf.reshape(masked_sums, [-1, 1]) seems will not be zeros during training, but it is also harmful due to
"division by 0", NAN issue may be caused by this reason.

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