Open ThummeTo opened 1 year ago
Forgot to post the error message:
ERROR: MethodError: no method matching track(::Tuple{Vector{Float64}, Vector{Float64}}, ::Vector{ReverseDiff.AbstractInstruction})
Closest candidates are:
track(::AbstractArray, ::Vector{ReverseDiff.AbstractInstruction}) at ...\ReverseDiff.jl\src\tracked.jl:469
track(::Real, ::Vector{ReverseDiff.AbstractInstruction}) at ...\ReverseDiff.jl\src\tracked.jl:467
track(::typeof(vcat), ::Union{Number, AbstractVecOrMat}...) at ...\ReverseDiff.jl\src\macros.jl:190
...
Stacktrace:
[1] track(#unused#::typeof(f_multi), x::ReverseDiff.TrackedArray{Float64, Float64, 1, Vector{Float64}, Vector{Float64}}, y::Vector{Float64})
@ Main ...\ReverseDiff.jl\src\macros.jl:329
[2] f_multi(x::ReverseDiff.TrackedArray{Float64, Float64, 1, Vector{Float64}, Vector{Float64}}, y::Vector{Float64})
@ Main ...\ReverseDiff.jl\src\macros.jl:324
[3] (::var"#17#18")(x::ReverseDiff.TrackedArray{Float64, Float64, 1, Vector{Float64}, Vector{Float64}})
@ Main ...\MWE_multi_reversediff.jl:44
[4] ReverseDiff.JacobianTape(f::var"#17#18", input::Vector{Float64}, cfg::ReverseDiff.JacobianConfig{ReverseDiff.TrackedArray{Float64, Float64, 1, Vector{Float64}, Vector{Float64}}, Nothing})
@ ReverseDiff ...\ReverseDiff.jl\src\api\tape.jl:229
[5] jacobian(f::Function, input::Vector{Float64}, cfg::ReverseDiff.JacobianConfig{ReverseDiff.TrackedArray{Float64, Float64, 1, Vector{Float64}, Vector{Float64}}, Nothing}) (repeats 2 times)
@ ReverseDiff ...\src\api\jacobians.jl:23
[6] top-level scope
@ ...\MWE_multi_reversediff.jl:44
+1 --- I've run into the same problem and my MWE is almost identical to the one above.
For me this is a huge problem, because I am hoping to use RevDiff over Zygote to get second derivatives. But when you implement a pullback of a pullback then you will typically have multiple outputs to take care of.
If anybody can suggest how to fix this or work around it, I'd be very grateful.
CC @tjjarvinen
Dear team,
first: Thanks for developing this nice package :-)
I think there is an error with the macro
@grad_from_chainrules
when using it on multi-output functions (for example a function that outputs a tuple of two vectors). Note, that gradient/jacobian determination is not part of the current Github-tests, only therrule
s are evaluated directly, but no gradient/jacobian is built for testing ReverseDiff with the correspondingrrule
. However this works fine for single-output functions together withReverseDiff.gradient
.See the following MWE:
Tested in Julia 1.8.5, all used libraries up-to-date.
Thanks in advance & best regards!