Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ForwardDiff.jl support? #28

Closed
longemen3000 opened this issue Jun 1, 2024 · 4 comments · Fixed by #29
Closed

ForwardDiff.jl support? #28

longemen3000 opened this issue Jun 1, 2024 · 4 comments · Fixed by #29

Comments

@longemen3000
Copy link
Contributor

is it possible to add ForwardDiff.jl support as an extension? i can help if it's necessary

@Expander
Copy link
Owner

Expander commented Jun 1, 2024

That's a good idea! How would that support look like? Would we have to provide additional overloads?

Now that you're asking, I'm wondering if there is a way to also support other differentiation libraries? Do you know if there is a generic way to support all of them?

@longemen3000
Copy link
Contributor Author

longemen3000 commented Jun 1, 2024

For ForwardDiff yes, you would need to support overloads, I can make a PR with the corresponding changes to allow support.
For the rest of AD libraries, I think you only need to support ChainRules.jl. Most of the AD libraries in Julia take ad rules using ChainRules. There is also Enzyme.jl, but Ive never written overloads for that package.

The way to support this is via the pkg extension mechanism (from Julia 1.9 onwards). This allows to only load the AD code if it's necessary

@Expander
Copy link
Owner

Expander commented Jun 1, 2024

A PR would be great! Could you please also add corresponding tests?

One question, though: Would this PR require to add a dependency? I'm asking, because I'd like to avoid this as much as possible. (A "dev"-dependency in the [extras] section would be no problem.)

@longemen3000
Copy link
Contributor Author

The extension mechanism does not require direct dependencies (in partícular they are weak dependencies, added in the [weakdeps] section). Check this :https://julialang.org/blog/2023/04/julia-1.9-highlights/#package_extensions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants