You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mixed-mode Jacobian works great when we chose Enzyme or Zygote as the reverse mode backend, however, there seems to be some problems with Tracker.jl when it was chosen as the backend.
using ADTypes
using ForwardDiff
using Tracker
using Random
using StableRNGs
using DifferentiationInterface
using SparseConnectivityTracer
using SparseMatrixColorings
const DI = DifferentiationInterface
xbig =rand(1000)
sparse_mixed_backend =AutoSparse(
MixedMode(AutoForwardDiff(), AutoTracker()),
sparsity_detector=TracerSparsityDetector(),
coloring_algorithm=GreedyColoringAlgorithm(RandomOrder(MersenneTwister(0)))
)
arrowhead(x) = x .+ x[1] .+vcat(sum(x), zeros(eltype(x), length(x)-1))
prep=prepare_jacobian(arrowhead, sparse_mixed_backend, xbig)
DI.jacobian(arrowhead, prep, sparse_mixed_backend, xbig)
Error
ERROR: MethodError: no method matching Float64(::Tracker.TrackedReal{Float64})
The type `Float64` exists, but no method is defined for this combination of argument types when trying to construct it.
Closest candidates are:
(::Type{T})(::Real, ::RoundingMode) where T<:AbstractFloat
@ Base rounding.jl:265
(::Type{T})(::T) where T<:Number
@ Core boot.jl:900Float64(::IrrationalConstants.Invsqrtπ)
@ IrrationalConstants ~/.julia/packages/IrrationalConstants/vp5v4/src/macro.jl:112...
Stacktrace:
[1] convert(::Type{Float64}, x::Tracker.TrackedReal{Float64})
@ Base ./number.jl:7
[2] setindex!(A::Vector{Float64}, x::Tracker.TrackedReal{Float64}, i::Int64)
@ Base ./array.jl:976
[3] (::Tracker.var"#506#508"{@Kwargs{}, TrackedVector{Float64, Vector{Float64}}, Tuple{Int64}})(Δ::Tracker.TrackedReal{Tracker.TrackedReal{Float64}})
@ Tracker ~/.julia/packages/Tracker/6rnwO/src/lib/array.jl:103
[4] back_(g::Tracker.Grads, c::Tracker.Call{Tracker.var"#506#508"{…}, Tuple{…}}, Δ::Tracker.TrackedReal{Tracker.TrackedReal{…}})
@ Tracker ~/.julia/packages/Tracker/6rnwO/src/back.jl:110
[5] back(g::Tracker.Grads, x::Tracker.Tracked{Float64}, Δ::Tracker.TrackedReal{Tracker.TrackedReal{Float64}})
@ Tracker ~/.julia/packages/Tracker/6rnwO/src/back.jl:125
[6] #710
@ ~/.julia/packages/Tracker/6rnwO/src/back.jl:113 [inlined]
[7] #72
@ ./tuple.jl:693 [inlined]
[8] BottomRF
@ ./reduce.jl:86 [inlined]
[9] _foldl_impl(op::Base.BottomRF{Base.var"#72#73"{Tracker.var"#710#711"{…}}}, init::Nothing, itr::Base.Iterators.Zip{Tuple{Tuple{…}, Tuple{…}}})
@ Base ./reduce.jl:62
[10] foldl_impl
@ ./reduce.jl:48 [inlined]
[11] mapfoldl_impl
@ ./reduce.jl:44 [inlined]
[12] mapfoldl
@ ./reduce.jl:175 [inlined]
[13] foldl
@ ./reduce.jl:198 [inlined]
[14] foreach
@ ./tuple.jl:693 [inlined]
[15] back_(g::Tracker.Grads, c::Tracker.Call{Tracker.var"#back#703"{…}, Tuple{…}}, Δ::Vector{Float64})
@ Tracker ~/.julia/packages/Tracker/6rnwO/src/back.jl:113
[16] back(g::Tracker.Grads, x::Tracker.Tracked{Vector{Tracker.TrackedReal{Float64}}}, Δ::Vector{Float64})
@ Tracker ~/.julia/packages/Tracker/6rnwO/src/back.jl:125
[17] #712
@ ~/.julia/packages/Tracker/6rnwO/src/back.jl:140 [inlined]
[18] #715
@ ~/.julia/packages/Tracker/6rnwO/src/back.jl:149 [inlined]
[19] (::DifferentiationInterfaceTrackerExt.var"#3#4"{Tracker.var"#715#717"{Tuple{TrackedVector{…}}, Tracker.var"#712#713"{Params, TrackedVector{…}}}})(dy::Vector{Float64})
@ DifferentiationInterfaceTrackerExt ~/.julia/packages/DifferentiationInterface/S3Qp3/ext/DifferentiationInterfaceTrackerExt/DifferentiationInterfaceTrackerExt.jl:60
[20] map
@ ./tuple.jl:355 [inlined]
[21] value_and_pullback
@ ~/.julia/packages/DifferentiationInterface/S3Qp3/ext/DifferentiationInterfaceTrackerExt/DifferentiationInterfaceTrackerExt.jl:59 [inlined]
[22] value_and_pullback!(::typeof(arrowhead), ::Tuple{…}, ::DifferentiationInterfaceTrackerExt.TrackerPullbackPrepSamePoint{…}, ::AutoTracker, ::Vector{…}, ::Tuple{…})
@ DifferentiationInterface ~/.julia/packages/DifferentiationInterface/S3Qp3/src/first_order/pullback.jl:204
[23] pullback!
@ ~/.julia/packages/DifferentiationInterface/S3Qp3/src/first_order/pullback.jl:229 [inlined]
[24] _sparse_jacobian_aux!(::Tuple{…}, ::SparseArrays.SparseMatrixCSC{…}, ::DifferentiationInterfaceSparseMatrixColoringsExt.MixedModeSparseJacobianPrep{…}, ::AutoSparse{…}, ::Vector{…})
@ DifferentiationInterfaceSparseMatrixColoringsExt ~/.julia/packages/DifferentiationInterface/S3Qp3/ext/DifferentiationInterfaceSparseMatrixColoringsExt/jacobian_mixed.jl:208
[25] jacobian!
@ ~/.julia/packages/DifferentiationInterface/S3Qp3/ext/DifferentiationInterfaceSparseMatrixColoringsExt/jacobian.jl:158 [inlined]
[26] jacobian(::typeof(arrowhead), ::DifferentiationInterfaceSparseMatrixColoringsExt.MixedModeSparseJacobianPrep{…}, ::AutoSparse{…}, ::Vector{…})
@ DifferentiationInterfaceSparseMatrixColoringsExt ~/.julia/packages/DifferentiationInterface/S3Qp3/ext/DifferentiationInterfaceSparseMatrixColoringsExt/jacobian.jl:165
[27] top-level scope
@ REPL[15]:1
Some type information was truncated. Use `show(err)` to see complete types.
The text was updated successfully, but these errors were encountered:
Mixed-mode Jacobian works great when we chose Enzyme or Zygote as the reverse mode backend, however, there seems to be some problems with Tracker.jl when it was chosen as the backend.
Error
The text was updated successfully, but these errors were encountered: