Skip to content

Recommended approach for forward mode value_and_grad #23645

Answered by jakevdp
lockwo asked this question in Q&A
Discussion options

You must be logged in to vote

See #762, where there has been discussion in the past about adding various value_and_* functions. Looking at #762 (comment), it seems like the resolution was that you could define such functions yourself if needed (the result looks really close to the recipe you came up with).

In your case, though, I think it's a bit more specialized because you're computing the element-wise gradient, but returning the mean of the value, so I'm not sure you'd be able to do better than the custom implementation you have.

What do you think?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lockwo
Comment options

Answer selected by lockwo
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