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

Missing frules for copy #729

Open
fredrikekre opened this issue Jul 27, 2023 · 1 comment
Open

Missing frules for copy #729

fredrikekre opened this issue Jul 27, 2023 · 1 comment
Labels

Comments

@fredrikekre
Copy link

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
@oxinabox
Copy link
Member

the frule for copy is to copy both primal and derivative.

@oxinabox oxinabox changed the title Missing rules for copy Missing frules for copy Jul 27, 2023
@oxinabox oxinabox added the good first issue Good for newcomers label Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants