JuliaDiff / JuliaDiff/ChainRules.jl
Missing frules for `copy`
Open
Nobody has claimed this yet.
good first issue
missing rule
- Dominant language
- Julia
- Stars
- 475
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
Simple example of taking the jacobian of identity, but idently is implemeted as a copy:
julia> import Diffractor
julia> import AbstractDifferentiation as AD
julia> AD.jacobian(Diffractor.DiffractorForwardBackend(), copy, rand(2))
ERROR: Attempted to AD a foreigncall. Missing rule?
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] copy
@ Diffractor ./array.jl:409 [inlined]
[3] (::Diffractor.∂☆recurse{…})(::ZeroBundle{…}, ::Diffractor.TangentBundle{…})
@ Diffractor ~/.julia/packages/Diffractor/QyO8B/src/stage1/recurse_fwd.jl:0
[4] (::Diffractor.∂☆internal{1})(::ZeroBundle{1, typeof(copy)}, ::Vararg{Diffractor.AbstractTangentBundle{1}})
@ Diffractor ~/.julia/packages/Diffractor/QyO8B/src/stage1/forward.jl:121
[5] (::Diffractor.∂☆{1})(::ZeroBundle{1, typeof(copy)}, ::Vararg{Diffractor.AbstractTangentBundle{1}})
@ Diffractor ~/.julia/packages/Diffractor/QyO8B/src/stage1/forward.jl:160
[6] (::Diffractor.var"#pushforward#359"{typeof(copy), Tuple{Vector{Float64}}})(vs::Tuple{Vector{Float64}})
@ Diffractor ~/.julia/packages/Diffractor/QyO8B/src/AbstractDifferentiation.jl:13
[7] (::Diffractor.var"#358#362"{Diffractor.var"#pushforward#359"{typeof(copy), Tuple{Vector{…}}}})(cols::Vector{Float64})
@ Diffractor ~/.julia/packages/AbstractDifferentiation/eEkWP/src/AbstractDifferentiation.jl:526
[8] mapslices(f::Diffractor.var"#358#362"{Diffractor.var"#pushforward#359"{…}}, A::Matrix{Float64}; dims::Int64)
@ Base ./abstractarray.jl:3179
[9] jacobian(b::Diffractor.DiffractorForwardBackend, f::Function, args::Vector{Float64})
@ Diffractor ~/.julia/packages/AbstractDifferentiation/eEkWP/src/AbstractDifferentiation.jl:524
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 stack trace at copy in Diffractor's array.jl:409, then inspect ChainRules' existing forward-mode rules for the corresponding copy operation. Confirm completion by rerunning the shown AD.jacobian example and checking that it returns the identity result instead of the missing-rule error.
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
- 38/100