SciML / SciML/LabelledArrays.jl
AD (Zygote, ForwardDiff) compatibility?
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 125
- Forks
- 20
- Avg merge
- 6h 3m
- Merged PRs (30d)
- 10
Description
LabelledArrays looks very promising to simplify model definitions. Unfortunately it seem largely incompatible with AD. Is there a good workaround?
using LabelledArrays
import ForwardDiff
import Zygote
model(p) = p.a + p.b^2 + p.c^3
p = LVector(a=1, b=2, c=3)
ps = SLVector(a=1, b=2, c=3)
model(ps)
model(p)
ForwardDiff.gradient(model, p) # works :)
Zygote.gradient(model, p) # ERROR: ArgumentError: invalid index: Val{:c}() of type Val{:c}
ForwardDiff.gradient(model, ps) # ERROR: type SArray has no field a
Zygote.gradient(model, ps) # ERROR: ArgumentError: invalid index: Val{:c}() of type Val{:c}
(In case of ForwardDiff this is probably related to #68)
Contributor guide
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
Reproduce the Julia examples for LVector and SLVector with ForwardDiff and Zygote, then inspect the compatibility concern linked to issue #68. Compare the reported field and Val-index errors across both array types; done would require a confirmed compatibility fix or a documented workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100