SciML / SciML/ComponentArrays.jl
AD failing with ComponentArrays
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 375
- Forks
- 42
- Avg merge
- 7h 25m
- Merged PRs (30d)
- 17
Description
Hi there, and thanks for the great package
Are ComponentArrays supposed to be AD-compatible? If so, did I do something wrong with the following code?
julia> using ComponentArrays, Zygote
julia> function mysum(x::AbstractVector)
y = ComponentVector(x=x)
return sum(y)
end
mysum (generic function with 1 method)
julia> Zygote.gradient(mysum, rand(10))
ERROR: MethodError: no method matching size(::NamedTuple{(:x,), Tuple{Vector{Float64}}})
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
Start with the reported mysum example, including ComponentVector construction and the Zygote.gradient entry point, and reproduce the size(::NamedTuple) error. Trace the ComponentArrays and automatic-differentiation interaction; done means the shown gradient call works as intended without the reported MethodError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100