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

TypeError: in new, expected DataType, got Type{ZeroBundle{1, B}} #199

Open
fredrikekre opened this issue Jul 27, 2023 · 0 comments
Open
Labels
bug Something isn't working forward-mode

Comments

@fredrikekre
Copy link

fredrikekre commented Jul 27, 2023

Simple example of taking the jacobian of the identity function, but the identity function is a comprehension

julia> import AbstractDifferentiation as AD

julia> function identity_comprehension(x)
           return [x[i] for i in eachindex(x)]
       end
identity_comprehension (generic function with 1 method)

julia> AD.jacobian(Diffractor.DiffractorForwardBackend(), identity_comprehension, rand(2))
ERROR: TypeError: in new, expected DataType, got Type{ZeroBundle{1, B}}
Stacktrace:
  [1] _TangentBundle
    @ Diffractor ~/.julia/packages/Diffractor/QyO8B/src/tangent.jl:148 [inlined]
  [2] TangentBundle
    @ Diffractor ~/.julia/packages/Diffractor/QyO8B/src/tangent.jl:251 [inlined]
  [3] (::Diffractor.∂☆internal{1})(args::Vararg{Diffractor.AbstractTangentBundle{1}})
    @ Diffractor ~/.julia/packages/Diffractor/QyO8B/src/stage1/forward.jl:149 [inlined]
  [4] (::Diffractor.∂☆{N})(args::Vararg{Diffractor.AbstractTangentBundle{N}}) where N
    @ Diffractor ~/.julia/packages/Diffractor/QyO8B/src/stage1/forward.jl:160 [inlined]
  [5] collect
    @ Diffractor ./array.jl:841 [inlined]
  [6] (::Diffractor.∂☆recurse{})(::ZeroBundle{…}, ::Diffractor.CompositeBundle{…})
    @ Diffractor ~/.julia/packages/Diffractor/QyO8B/src/stage1/recurse_fwd.jl:0
  [7] (::Diffractor.∂☆internal{1})(::ZeroBundle{1, typeof(collect)}, ::Vararg{Diffractor.AbstractTangentBundle{1}})
    @ Diffractor ~/.julia/packages/Diffractor/QyO8B/src/stage1/forward.jl:121
  [8] (::Diffractor.∂☆{1})(::ZeroBundle{1, typeof(collect)}, ::Vararg{Diffractor.AbstractTangentBundle{1}})
    @ Diffractor ~/.julia/packages/Diffractor/QyO8B/src/stage1/forward.jl:160
  [9] identity_comprehension
    @ Diffractor ./REPL[7]:2 [inlined]
 [10] ∂☆internal
    @ Diffractor ~/.julia/packages/Diffractor/QyO8B/src/stage1/forward.jl:121 [inlined]
 [11] (::Diffractor.∂☆{N})(args::Vararg{Diffractor.AbstractTangentBundle{N}}) where N
    @ Diffractor ~/.julia/packages/Diffractor/QyO8B/src/stage1/forward.jl:160 [inlined]
 [12] (::Diffractor.var"#pushforward#359"{typeof(identity_comprehension), Tuple{Vector{Float64}}})(vs::Tuple{Vector{Float64}})
    @ Diffractor ~/.julia/packages/Diffractor/QyO8B/src/AbstractDifferentiation.jl:13
 [13] (::Diffractor.var"#358#362")(cols::Any)
    @ Diffractor ~/.julia/packages/AbstractDifferentiation/eEkWP/src/AbstractDifferentiation.jl:526 [inlined]
 [14] mapslices(f::Diffractor.var"#358#362"{Diffractor.var"#pushforward#359"{}}, A::Matrix{Float64}; dims::Int64)
    @ Base ./abstractarray.jl:3179
 [15] jacobian(b::Diffractor.DiffractorForwardBackend, f::Function, args::Vector{Float64})
    @ Diffractor ~/.julia/packages/AbstractDifferentiation/eEkWP/src/AbstractDifferentiation.jl:524
@oxinabox oxinabox added bug Something isn't working forward-mode labels Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working forward-mode
Projects
None yet
Development

No branches or pull requests

2 participants