AbstractDifferentiation.jl icon indicating copy to clipboard operation
AbstractDifferentiation.jl copied to clipboard

reimplement `value_and_pullback_function` and `value_and_pushforward_function`

Open mohamed82008 opened this issue 3 years ago • 3 comments

The current behavior of value_and_pullback_function/value_and_pushforward_function is that it returns a function which when called with the co-tangents/tangents as input returns both the function value at x and the tangent/co-tangent. The delayed return of the value of the function is unnecessary.

mohamed82008 avatar Aug 29 '21 03:08 mohamed82008

Isn't that the whole point of these functions?

Otherwise would be value_and_derivative? Which is a different function already provided

oxinabox avatar Aug 29 '21 07:08 oxinabox

Kind of. Currently the function returned by value_and_pullback_function takes a single input (co-tangents) and returns the function value and the pulled back co-tangents. So the value is returned in a lazy fashion after the co-tangents are passed in which is odd.

mohamed82008 avatar Aug 29 '21 16:08 mohamed82008

it's not a show-stopper right now as most users won't even use this function

mohamed82008 avatar Aug 29 '21 16:08 mohamed82008