JuliaDiff / AbstractDifferentiation.jl

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

Add second-order derivative functions #122

Closed gerlero closed 7 months ago

gerlero commented 8 months ago

Draft PR for changes discussed in https://github.com/JuliaDiff/ForwardDiff.jl/pull/678

Fixes #71.

codecov[bot] commented 8 months ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (211b675) 82.94% compared to head (72e4201) 83.37%. Report is 2 commits behind head on master.

Files Patch % Lines
src/AbstractDifferentiation.jl 93.33% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #122 +/- ## ========================================== + Coverage 82.94% 83.37% +0.42% ========================================== Files 8 8 Lines 428 451 +23 ========================================== + Hits 355 376 +21 - Misses 73 75 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

gdalle commented 8 months ago

I think the change is welcome here and coherent regardless of whether it makes it into ForwardDiff. However it probably needs tests too, which I guess is why the PR remains a draft. Thank you so much for taking the time!

gerlero commented 8 months ago

@gdalle Thanks. Tests are now live and passing so this is ready for review

gerlero commented 8 months ago

Gentle bump @gdalle; can you be a reviewer in this PR?

gerlero commented 8 months ago

@gdalle @devmotion Thanks for the reviews.

Any reason why you didn't add tests for Tracker and RuleConfig backends?

I simply omitted them because I saw that those backends don't have tests for hessian either. I've now tried adding the tests: RuleConfig passes, but Tracker fails (ArgumentError: Tracker backend does not support nested differentiation.). So, I've now added the RuleConfig backend tests, but left Tracker out.

EDIT: the RuleConfig tests fail with Julia nightly though..

gdalle commented 7 months ago

As soon as I understand what's going on with the tags, it's good to merge on my end

gerlero commented 7 months ago

Thanks. Can we get a new release with this feature?

devmotion commented 7 months ago

https://github.com/JuliaRegistries/General/pull/100271