JuliaDiff / JuliaDiff/AbstractDifferentiation.jl
How to use AbstractDifferentiation as a user?
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 138
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
Thanks for working on AbstractDifferentiation! It tackles a very relevant practical problem.
Unfortunately, I cannot figure out from the Readme how AbstractDifferentiation should be used.
The Readme says
"To use AbstractDifferentiation, first construct a backend instance ab::AD.AbstractBackend using your favorite differentiation package in Julia that supports AbstractDifferentiation."
but does not explain how to do this, see my failed attempt below (inspired from the test code).
Also,iIt would be nice if I could list all available backends somehow.
using AbstractDifferentiation
import Zygote
import ForwardDiff
# test function
foo(x) = sin(x[1]) + prod(x[2:end].^2)
x = rand(4)
# direct usage works
Zygote.gradient(foo, x)[1]
ForwardDiff.gradient(foo, x)
# Is this the correct way to create a Backend?
struct ForwardDiffBackend1 <: AD.AbstractForwardMode end
const forwarddiff_backend1 = ForwardDiffBackend1()
struct ZygoteBackend1 <: AD.AbstractReverseMode end
const zygote_backend1 = ZygoteBackend1()
# both fail with:
# MethodError: no method matching adjoint(::Nothing)
AD.gradient(zygote_backend1, foo, x)
AD.gradient(forwarddiff_backend1, foo, x)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the README and the test code referenced in the issue to understand how AbstractDifferentiation backends are constructed and used. Document a working version of the shown AD.gradient example and explain how users can discover available backends; done means the README answers both questions without requiring the failed attempt as a guide.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100