Skip to content

Custom vjp vs jvp for newton's method #5759

Answered by mattjj
mrtupek asked this question in General
Discussion options

You must be logged in to vote

Thanks for the question!

The reason is that a custom_vjp defines how a function should behave only under reverse-mode autodiff, using a custom rule. It leaves undefined how a function should behave under forward-mode autodiff.

If you define a custom_jvp then you can use both forward- and reverse-mode autodiff because even though your rule only specifies how the function should behave under forward-mode autodiff, JAX will attempt to automatically transpose the forward-mode rule (see the pdf on this page for a description of how automatic transposition relates to autodiff).

We could in principle attempt automatic transposition of a custom_vjp rule. We haven't yet only because that'd be a bi…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@mrtupek
Comment options

@shoyer
Comment options

@mrtupek
Comment options

@shoyer
Comment options

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