JuliaDiff / AbstractDifferentiation.jl

An abstract interface for automatic differentiation.
https://juliadiff.org/AbstractDifferentiation.jl/
MIT License
137 stars 18 forks source link

`value_and_pullback_function` doesn't do what its docstring says #124

Closed gdalle closed 9 months ago

gdalle commented 10 months ago

It returns val, (tangents -> pullbacks) instead of tangents -> (val, pullbacks)

For comparison, the forward equivalent does tangents -> (val, pushforwards) which is what it promises

ToucheSir commented 10 months ago

I recall this came up before in a different issue/PR thread, and the comment then was that this returns a tuple of "value" and "pullback function" rather than a "value and pullback"-returning function. Certainly the former seems to make more sense when we're talking about split reverse mode AD?

gdalle commented 10 months ago

Regardless of what the best interpretation would be (I personally find this ambiguity horrifying), I think it would be good to fix the docstring first instead of changing the behavior. If you wanna review the associated PR #125 I can merge it afterwards :)

ToucheSir commented 10 months ago

You'll find no complaints from me there, not sure why it wasn't called e.g. value_and_pullback in the first place!