Skip to content

Wrong gradients in simple NNs #18185

Answered by jakevdp
SNMS95 asked this question in Q&A
Oct 19, 2023 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

If I run your example in 64-bit precision with eps=1E-6, I find that the gradients match. In float32 precision, if I use a smaller eps then the numerical result diverges.

This makes me think that your function has a fast-varying second derivative, which makes the numerical gradient inaccurate, but nevertheless the analytic gradient is probably producing the correct value.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@SNMS95
Comment options

@jakevdp
Comment options

Answer selected by SNMS95
@SNMS95
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants