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

Tangent being Constructed with wrong type in forward mode #152

Closed
oxinabox opened this issue May 22, 2023 · 0 comments · Fixed by #153
Closed

Tangent being Constructed with wrong type in forward mode #152

oxinabox opened this issue May 22, 2023 · 0 comments · Fixed by #153

Comments

@oxinabox
Copy link
Member

Found this when trying to reproduce something else.
I though we had fixed these but I guess not

julia> using Diffractor

julia> var"'" = Diffractor.PrimeDerivativeFwd
Diffractor.PrimeDerivativeFwd

julia> struct Foo
       x::Float64
       end

julia> f(x) = Foo(x)
f (generic function with 1 method)

julia> f(23)
Foo(23.0)

julia> f'(23)
ERROR: ArgumentError: Tangent for the primal Foo should be backed by a NamedTuple type, not by Tuple{Int64}.
Stacktrace:
 [1] _backing_error(P::Type, G::Type, E::Type)
   @ ChainRulesCore ~/.julia/packages/ChainRulesCore/0t04l/src/tangent_types/tangent.jl:62
 [2] ChainRulesCore.Tangent{Foo, Tuple{Int64}}(backing::Tuple{Int64})
   @ ChainRulesCore ~/.julia/packages/ChainRulesCore/0t04l/src/tangent_types/tangent.jl:36
 [3] (ChainRulesCore.Tangent{Foo})(args::Int64)
   @ ChainRulesCore ~/.julia/packages/ChainRulesCore/0t04l/src/tangent_types/tangent.jl:48
 [4] getindex(tb::Diffractor.CompositeBundle{1, Foo, Tuple{Diffractor.TangentBundle{1, Float64, Diffractor.TaylorTangent{Tuple{Int64}}}}}, tti::Diffractor.TaylorTangentIndex)
   @ Diffractor ~/JuliaEnvs/Diffractor.jl/src/tangent.jl:299
 [5] (::Diffractor.PrimeDerivativeFwd{1, typeof(f)})(x::Int64)
   @ Diffractor ~/JuliaEnvs/Diffractor.jl/src/interface.jl:180
 [6] top-level scope
   @ REPL[9]:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant