Skip to content

Limitations of forward mode AD #9328

Answered by YouJiacheng
ipcamit asked this question in General
Jan 25, 2022 · 3 comments · 11 replies
Discussion options

You must be logged in to vote

brief explanation:
In forward-mode AD, we define jacobian-vector-product function jvp(f, x, v) for each basic operator f.
Where x is the point to differentiate the function, and v is the vector to product.
And jvp(f, x, v) == J_f[x]v for all x and v, where J_f[x] is the jacobian matrix of f at the point x.
For the function composition h(x)=g(f(x)), we can recursively obtain its jacobian-vector-product function.
Namely jvp(h, x, v) = jvp(g, f(x), jvp(f, x, v)), since J_h[x]v=J_g[f(x)]J_f[x]v.
Finally, we vectorize jvp w.r.t. v, and get jacfwd(f, x) = jvp_vectorized(f, x, I), where I is identity matrix.


Edited:
Actually, jax.jvp does compute gradient and function value in a single pass(the…

Replies: 3 comments 11 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by ipcamit
Comment options

You must be logged in to vote
8 replies
@YouJiacheng
Comment options

@ipcamit
Comment options

@YouJiacheng
Comment options

@hawkinsp
Comment options

@ipcamit
Comment options

Comment options

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

@hawkinsp
Comment options

@YouJiacheng
Comment options

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