NaNs with AD #6117
Unanswered
OlaRonning
asked this question in
Q&A
NaNs with AD
#6117
Replies: 1 comment 1 reply
-
Thanks for the question! This is a commonly-encountered issue in autodiff systems; you can read about it here: FAQ: Gradients contain NaN where using |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm working on an MD project, and I came across an oddity with AD in Jax. The gradient/Jacobian of a function with a
jnp.where
andjnp.sqrt
produces NaNs depending on whether thejnp.sqrt
is nested inside thejnp.where
or after thejnp.where
. If I take the element-wise product with another function and compute the gradient, the opposite pair of functions producesNaNs
. I have a minimal example below.I assume the difference in their behavior arises from the way the IR is generated; however, I've not found the exact cause. What is the cause of this? And, is the behavior expected?
Beta Was this translation helpful? Give feedback.
All reactions