Closed prbzrg closed 1 year ago
Error:
┌ Warning: ZygoteVJP tried and failed in the automated AD choice algorithm with the following error. (To turn off this printing, add `verbose = false` to the `solve` call)
└ @ SciMLSensitivity C:\Users\Hossein Pourbozorg\.julia\packages\SciMLSensitivity\dM3nj\src\concrete_solve.jl:80
Mutating arrays is not supported -- called setindex!(Vector{Float32}, ...)
This error occurs when you ask Zygote to differentiate operations that change
the elements of arrays in place (e.g. setting values with x .= ...)
Possible fixes:
- avoid mutating operations (preferred)
- or read the documentation and solutions for this error
https://fluxml.ai/Zygote.jl/latest/limitations
┌ Warning: ReverseDiffVJP tried and failed in the automated AD choice algorithm with the following error. (To turn off this printing, add `verbose = false` to the `solve` call)
└ @ SciMLSensitivity C:\Users\Hossein Pourbozorg\.julia\packages\SciMLSensitivity\dM3nj\src\concrete_solve.jl:93
MethodError: no method matching gradient(::SciMLSensitivity.var"#255#258"{ODEProblem{Matrix{Float32}, Tuple{Float32, Float32}, false, ComponentVector{Float32, Vector{Float32}, Tuple{Axis{(weight = ViewAxis(1:1, ShapedAxis((1, 1), NamedTuple())), bias = ViewAxis(2:2, ShapedAxis((1, 1), NamedTuple())))}}}, ODEFunction{false,SciMLBase.FullSpecialize,ICNF.var"#f_aug#48"{RNODE{Float32, Array, ZygoteMatrixMode}, NamedTuple{(), Tuple{}}, Matrix{Float32}, Int64},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,typeof(SciMLBase.DEFAULT_OBSERVED),Nothing,Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}}, ::Matrix{Float32}, ::ComponentVector{Float32, Vector{Float32}, Tuple{Axis{(weight = ViewAxis(1:1, ShapedAxis((1, 1), NamedTuple())), bias = ViewAxis(2:2, ShapedAxis((1, 1), NamedTuple())))}}})
Closest candidates are:
gradient(::Any, ::Any) at C:\Users\Hossein Pourbozorg\.julia\packages\ReverseDiff\YkVxM\src\api\gradients.jl:21
gradient(::Any, ::Any, ::ReverseDiff.GradientConfig) at C:\Users\Hossein Pourbozorg\.julia\packages\ReverseDiff\YkVxM\src\api\gradients.jl:21
┌ Warning: TrackerVJP tried and failed in the automated AD choice algorithm with the following error. (To turn off this printing, add `verbose = false` to the `solve` call)
└ @ SciMLSensitivity C:\Users\Hossein Pourbozorg\.julia\packages\SciMLSensitivity\dM3nj\src\concrete_solve.jl:107
UndefRefError: access to undefined reference
┌ Warning: Reverse-Mode AD VJP choices all failed. Falling back to numerical VJPs
└ @ SciMLSensitivity C:\Users\Hossein Pourbozorg\.julia\packages\SciMLSensitivity\dM3nj\src\concrete_solve.jl:117
ERROR: LoadError: MethodError: no method matching forwarddiffs_model_time(::Nothing)
Closest candidates are:
forwarddiffs_model_time(::Union{OrdinaryDiffEq.OrdinaryDiffEqRosenbrockAdaptiveAlgorithm, OrdinaryDiffEq.OrdinaryDiffEqRosenbrockAlgorithm}) at C:\Users\Hossein Pourbozorg\.julia\packages\OrdinaryDiffEq\r3zVj\src\alg_utils.jl:22
forwarddiffs_model_time(::SciMLBase.AbstractSciMLAlgorithm) at C:\Users\Hossein Pourbozorg\.julia\packages\SciMLBase\zXEYU\src\alg_traits.jl:32
Stacktrace:
[1] adjointdiffcache(g::Nothing, sensealg::InterpolatingAdjoint{0,false,Val{:central},Bool}, discrete::Bool, sol::SciMLBase.ODESolution{Float32, 3, Vector{Matrix{Float32}}, Nothing, Nothing, Vector{Float32}, Vector{Vector{Matrix{Float32}}}, ODEProblem{Matrix{Float32}, Tuple{Float32, Float32}, false, ComponentVector{Float32, Vector{Float32}, Tuple{Axis{(weight = ViewAxis(1:1, ShapedAxis((1, 1), NamedTuple())), bias = ViewAxis(2:2, ShapedAxis((1, 1), NamedTuple())))}}}, ODEFunction{false,SciMLBase.FullSpecialize,ICNF.var"#f_aug#48"{RNODE{Float32, Array, ZygoteMatrixMode}, NamedTuple{(), Tuple{}}, Matrix{Float32}, Int64},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,typeof(SciMLBase.DEFAULT_OBSERVED),Nothing,Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, CompositeAlgorithm{Tuple{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!),typeof(OrdinaryDiffEq.trivial_limiter!),Static.False}, TRBDF2{12,false,LinearSolve.LUFactorization{LinearAlgebra.RowMaximum},OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}},typeof(OrdinaryDiffEq.DEFAULT_PRECS),Val{:forward},true,nothing}},OrdinaryDiffEq.AutoSwitchCache{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!),typeof(OrdinaryDiffEq.trivial_limiter!),Static.False}, TRBDF2{0,false,Nothing,OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}},typeof(OrdinaryDiffEq.DEFAULT_PRECS),Val{:forward},true,nothing}, Rational{Int64}, Int64}}, OrdinaryDiffEq.CompositeInterpolationData{ODEFunction{false,SciMLBase.FullSpecialize,ICNF.var"#f_aug#48"{RNODE{Float32, Array, ZygoteMatrixMode}, NamedTuple{(), Tuple{}}, Matrix{Float32}, Int64},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,typeof(SciMLBase.DEFAULT_OBSERVED),Nothing,Nothing}, Vector{Matrix{Float32}}, Vector{Float32}, Vector{Vector{Matrix{Float32}}}, CompositeCache{Tuple{OrdinaryDiffEq.Tsit5ConstantCache, OrdinaryDiffEq.TRBDF2ConstantCache{OrdinaryDiffEq.TRBDF2Tableau{Float32, Float32}, OrdinaryDiffEq.NLSolver{OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}}, false, Matrix{Float32}, Float32, Nothing, Float32, OrdinaryDiffEq.NLNewtonConstantCache{Float32, Float32, Matrix{Float32}, LinearAlgebra.LU{Float32, Matrix{Float32}, Vector{Int64}}, SciMLBase.UDerivativeWrapper{ODEFunction{false,SciMLBase.FullSpecialize,ICNF.var"#f_aug#48"{RNODE{Float32, Array, ZygoteMatrixMode}, NamedTuple{(), Tuple{}}, Matrix{Float32}, Int64},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,typeof(SciMLBase.DEFAULT_OBSERVED),Nothing,Nothing}, Float32, ComponentVector{Float32, Vector{Float32}, Tuple{Axis{(weight = ViewAxis(1:1, ShapedAxis((1, 1), NamedTuple())), bias = ViewAxis(2:2, ShapedAxis((1, 1), NamedTuple())))}}}}}}}},OrdinaryDiffEq.AutoSwitchCache{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!),typeof(OrdinaryDiffEq.trivial_limiter!),Static.False}, TRBDF2{0,false,Nothing,OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}},typeof(OrdinaryDiffEq.DEFAULT_PRECS),Val{:forward},true,nothing}, Rational{Int64}, Int64}}}, DiffEqBase.DEStats, Vector{Int64}}, dgdu::Nothing, dgdp::Nothing, f::ODEFunction{false,SciMLBase.FullSpecialize,ICNF.var"#f_aug#48"{RNODE{Float32, Array, ZygoteMatrixMode}, NamedTuple{(), Tuple{}}, Matrix{Float32}, Int64},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,typeof(SciMLBase.DEFAULT_OBSERVED),Nothing,Nothing}, alg::Nothing; quad::Bool, noiseterm::Bool, needs_jac::Bool)
@ SciMLSensitivity C:\Users\Hossein Pourbozorg\.julia\packages\SciMLSensitivity\dM3nj\src\adjoint_common.jl:123
[2] SciMLSensitivity.ODEInterpolatingAdjointSensitivityFunction(g::Nothing, sensealg::InterpolatingAdjoint{0,false,Val{:central},Bool}, discrete::Bool, sol::SciMLBase.ODESolution{Float32, 3, Vector{Matrix{Float32}}, Nothing, Nothing, Vector{Float32}, Vector{Vector{Matrix{Float32}}}, ODEProblem{Matrix{Float32}, Tuple{Float32, Float32}, false, ComponentVector{Float32, Vector{Float32}, Tuple{Axis{(weight = ViewAxis(1:1, ShapedAxis((1, 1), NamedTuple())), bias = ViewAxis(2:2, ShapedAxis((1, 1), NamedTuple())))}}}, ODEFunction{false,SciMLBase.FullSpecialize,ICNF.var"#f_aug#48"{RNODE{Float32, Array, ZygoteMatrixMode}, NamedTuple{(), Tuple{}}, Matrix{Float32}, Int64},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,typeof(SciMLBase.DEFAULT_OBSERVED),Nothing,Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, CompositeAlgorithm{Tuple{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!),typeof(OrdinaryDiffEq.trivial_limiter!),Static.False}, TRBDF2{12,false,LinearSolve.LUFactorization{LinearAlgebra.RowMaximum},OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}},typeof(OrdinaryDiffEq.DEFAULT_PRECS),Val{:forward},true,nothing}},OrdinaryDiffEq.AutoSwitchCache{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!),typeof(OrdinaryDiffEq.trivial_limiter!),Static.False}, TRBDF2{0,false,Nothing,OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}},typeof(OrdinaryDiffEq.DEFAULT_PRECS),Val{:forward},true,nothing}, Rational{Int64}, Int64}}, OrdinaryDiffEq.CompositeInterpolationData{ODEFunction{false,SciMLBase.FullSpecialize,ICNF.var"#f_aug#48"{RNODE{Float32, Array, ZygoteMatrixMode}, NamedTuple{(), Tuple{}}, Matrix{Float32}, Int64},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,typeof(SciMLBase.DEFAULT_OBSERVED),Nothing,Nothing}, Vector{Matrix{Float32}}, Vector{Float32}, Vector{Vector{Matrix{Float32}}}, CompositeCache{Tuple{OrdinaryDiffEq.Tsit5ConstantCache, OrdinaryDiffEq.TRBDF2ConstantCache{OrdinaryDiffEq.TRBDF2Tableau{Float32, Float32}, OrdinaryDiffEq.NLSolver{OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}}, false, Matrix{Float32}, Float32, Nothing, Float32, OrdinaryDiffEq.NLNewtonConstantCache{Float32, Float32, Matrix{Float32}, LinearAlgebra.LU{Float32, Matrix{Float32}, Vector{Int64}}, SciMLBase.UDerivativeWrapper{ODEFunction{false,SciMLBase.FullSpecialize,ICNF.var"#f_aug#48"{RNODE{Float32, Array, ZygoteMatrixMode}, NamedTuple{(), Tuple{}}, Matrix{Float32}, Int64},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,typeof(SciMLBase.DEFAULT_OBSERVED),Nothing,Nothing}, Float32, ComponentVector{Float32, Vector{Float32}, Tuple{Axis{(weight = ViewAxis(1:1, ShapedAxis((1, 1), NamedTuple())), bias = ViewAxis(2:2, ShapedAxis((1, 1), NamedTuple())))}}}}}}}},OrdinaryDiffEq.AutoSwitchCache{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!),typeof(OrdinaryDiffEq.trivial_limiter!),Static.False}, TRBDF2{0,false,Nothing,OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}},typeof(OrdinaryDiffEq.DEFAULT_PRECS),Val{:forward},true,nothing}, Rational{Int64}, Int64}}}, DiffEqBase.DEStats, Vector{Int64}}, dgdu::Nothing, dgdp::Nothing, f::ODEFunction{false,SciMLBase.FullSpecialize,ICNF.var"#f_aug#48"{RNODE{Float32, Array, ZygoteMatrixMode}, NamedTuple{(), Tuple{}}, Matrix{Float32}, Int64},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,typeof(SciMLBase.DEFAULT_OBSERVED),Nothing,Nothing}, alg::Nothing, checkpoints::Vector{Float32}, tols::NamedTuple{(:reltol, :abstol), Tuple{Float64, Float64}}, tstops::Nothing; noiseterm::Bool, tspan::Tuple{Float32, Float32})
@ SciMLSensitivity C:\Users\Hossein Pourbozorg\.julia\packages\SciMLSensitivity\dM3nj\src\interpolating_adjoint.jl:106
[3] ODEAdjointProblem(sol::SciMLBase.ODESolution{Float32, 3, Vector{Matrix{Float32}}, Nothing, Nothing, Vector{Float32}, Vector{Vector{Matrix{Float32}}}, ODEProblem{Matrix{Float32}, Tuple{Float32, Float32}, false, ComponentVector{Float32, Vector{Float32}, Tuple{Axis{(weight = ViewAxis(1:1, ShapedAxis((1, 1), NamedTuple())), bias = ViewAxis(2:2, ShapedAxis((1, 1), NamedTuple())))}}}, ODEFunction{false,SciMLBase.FullSpecialize,ICNF.var"#f_aug#48"{RNODE{Float32, Array, ZygoteMatrixMode}, NamedTuple{(), Tuple{}}, Matrix{Float32}, Int64},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,typeof(SciMLBase.DEFAULT_OBSERVED),Nothing,Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, CompositeAlgorithm{Tuple{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!),typeof(OrdinaryDiffEq.trivial_limiter!),Static.False}, TRBDF2{12,false,LinearSolve.LUFactorization{LinearAlgebra.RowMaximum},OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}},typeof(OrdinaryDiffEq.DEFAULT_PRECS),Val{:forward},true,nothing}},OrdinaryDiffEq.AutoSwitchCache{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!),typeof(OrdinaryDiffEq.trivial_limiter!),Static.False}, TRBDF2{0,false,Nothing,OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}},typeof(OrdinaryDiffEq.DEFAULT_PRECS),Val{:forward},true,nothing}, Rational{Int64}, Int64}}, OrdinaryDiffEq.CompositeInterpolationData{ODEFunction{false,SciMLBase.FullSpecialize,ICNF.var"#f_aug#48"{RNODE{Float32, Array, ZygoteMatrixMode}, NamedTuple{(), Tuple{}}, Matrix{Float32}, Int64},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,typeof(SciMLBase.DEFAULT_OBSERVED),Nothing,Nothing}, Vector{Matrix{Float32}}, Vector{Float32}, Vector{Vector{Matrix{Float32}}}, CompositeCache{Tuple{OrdinaryDiffEq.Tsit5ConstantCache, OrdinaryDiffEq.TRBDF2ConstantCache{OrdinaryDiffEq.TRBDF2Tableau{Float32, Float32}, OrdinaryDiffEq.NLSolver{OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}}, false, Matrix{Float32}, Float32, Nothing, Float32, OrdinaryDiffEq.NLNewtonConstantCache{Float32, Float32, Matrix{Float32}, LinearAlgebra.LU{Float32, Matrix{Float32}, Vector{Int64}}, SciMLBase.UDerivativeWrapper{ODEFunction{false,SciMLBase.FullSpecialize,ICNF.var"#f_aug#48"{RNODE{Float32, Array, ZygoteMatrixMode}, NamedTuple{(), Tuple{}}, Matrix{Float32}, Int64},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,typeof(SciMLBase.DEFAULT_OBSERVED),Nothing,Nothing}, Float32, ComponentVector{Float32, Vector{Float32}, Tuple{Axis{(weight = ViewAxis(1:1, ShapedAxis((1, 1), NamedTuple())), bias = ViewAxis(2:2, ShapedAxis((1, 1), NamedTuple())))}}}}}}}},OrdinaryDiffEq.AutoSwitchCache{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!),typeof(OrdinaryDiffEq.trivial_limiter!),Static.False}, TRBDF2{0,false,Nothing,OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}},typeof(OrdinaryDiffEq.DEFAULT_PRECS),Val{:forward},true,nothing}, Rational{Int64}, Int64}}}, DiffEqBase.DEStats, Vector{Int64}}, sensealg::InterpolatingAdjoint{0,false,Val{:central},Bool}, alg::Nothing, t::Vector{Float32}, dgdu_discrete::SciMLSensitivity.var"#df_iip#277"{Array{Float32, 3}, Colon}, dgdp_discrete::Nothing, dgdu_continuous::Nothing, dgdp_continuous::Nothing, g::Nothing, ::Val{true}; checkpoints::Vector{Float32}, callback::Nothing, reltol::Float64, abstol::Float64, kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:verbose,), Tuple{Bool}}})
@ SciMLSensitivity C:\Users\Hossein Pourbozorg\.julia\packages\SciMLSensitivity\dM3nj\src\interpolating_adjoint.jl:356
[4] _adjoint_sensitivities(sol::SciMLBase.ODESolution{Float32, 3, Vector{Matrix{Float32}}, Nothing, Nothing, Vector{Float32}, Vector{Vector{Matrix{Float32}}}, ODEProblem{Matrix{Float32}, Tuple{Float32, Float32}, false, ComponentVector{Float32, Vector{Float32}, Tuple{Axis{(weight = ViewAxis(1:1, ShapedAxis((1, 1), NamedTuple())), bias = ViewAxis(2:2, ShapedAxis((1, 1), NamedTuple())))}}}, ODEFunction{false,SciMLBase.FullSpecialize,ICNF.var"#f_aug#48"{RNODE{Float32, Array, ZygoteMatrixMode}, NamedTuple{(), Tuple{}}, Matrix{Float32}, Int64},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,typeof(SciMLBase.DEFAULT_OBSERVED),Nothing,Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, CompositeAlgorithm{Tuple{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!),typeof(OrdinaryDiffEq.trivial_limiter!),Static.False}, TRBDF2{12,false,LinearSolve.LUFactorization{LinearAlgebra.RowMaximum},OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}},typeof(OrdinaryDiffEq.DEFAULT_PRECS),Val{:forward},true,nothing}},OrdinaryDiffEq.AutoSwitchCache{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!),typeof(OrdinaryDiffEq.trivial_limiter!),Static.False}, TRBDF2{0,false,Nothing,OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}},typeof(OrdinaryDiffEq.DEFAULT_PRECS),Val{:forward},true,nothing}, Rational{Int64}, Int64}}, OrdinaryDiffEq.CompositeInterpolationData{ODEFunction{false,SciMLBase.FullSpecialize,ICNF.var"#f_aug#48"{RNODE{Float32, Array, ZygoteMatrixMode}, NamedTuple{(), Tuple{}}, Matrix{Float32}, Int64},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,typeof(SciMLBase.DEFAULT_OBSERVED),Nothing,Nothing}, Vector{Matrix{Float32}}, Vector{Float32}, Vector{Vector{Matrix{Float32}}}, CompositeCache{Tuple{OrdinaryDiffEq.Tsit5ConstantCache, OrdinaryDiffEq.TRBDF2ConstantCache{OrdinaryDiffEq.TRBDF2Tableau{Float32, Float32}, OrdinaryDiffEq.NLSolver{OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}}, false, Matrix{Float32}, Float32, Nothing, Float32, OrdinaryDiffEq.NLNewtonConstantCache{Float32, Float32, Matrix{Float32}, LinearAlgebra.LU{Float32, Matrix{Float32}, Vector{Int64}}, SciMLBase.UDerivativeWrapper{ODEFunction{false,SciMLBase.FullSpecialize,ICNF.var"#f_aug#48"{RNODE{Float32, Array, ZygoteMatrixMode}, NamedTuple{(), Tuple{}}, Matrix{Float32}, Int64},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,typeof(SciMLBase.DEFAULT_OBSERVED),Nothing,Nothing}, Float32, ComponentVector{Float32, Vector{Float32}, Tuple{Axis{(weight = ViewAxis(1:1, ShapedAxis((1, 1), NamedTuple())), bias = ViewAxis(2:2, ShapedAxis((1, 1), NamedTuple())))}}}}}}}},OrdinaryDiffEq.AutoSwitchCache{Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!),typeof(OrdinaryDiffEq.trivial_limiter!),Static.False}, TRBDF2{0,false,Nothing,OrdinaryDiffEq.NLNewton{Rational{Int64}, Rational{Int64}, Rational{Int64}, Rational{Int64}},typeof(OrdinaryDiffEq.DEFAULT_PRECS),Val{:forward},true,nothing}, Rational{Int64}, Int64}}}, DiffEqBase.DEStats, Vector{Int64}}, sensealg::InterpolatingAdjoint{0,false,Val{:central},Bool}, alg::Nothing; t::Vector{Float32}, dgdu_discrete::Function, dgdp_discrete::Nothing, dgdu_continuous::Nothing, dgdp_continuous::Nothing, g::Nothing, abstol::Float64, reltol::Float64, checkpoints::Vector{Float32}, corfunc_analytical::Nothing, callback::Nothing, kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:verbose,), Tuple{Bool}}})
@ SciMLSensitivity C:\Users\Hossein Pourbozorg\.julia\packages\SciMLSensitivity\dM3nj\src\sensitivity_interface.jl:407
[5] #adjoint_sensitivities#67
@ C:\Users\Hossein Pourbozorg\.julia\packages\SciMLSensitivity\dM3nj\src\sensitivity_interface.jl:386 [inlined]
[6] (::SciMLSensitivity.var"#adjoint_sensitivity_backpass#276"{Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:verbose,), Tuple{Bool}}}, Nothing, InterpolatingAdjoint{0,false,Val{:central},Bool}, Matrix{Float32}, ComponentVector{Float32, Vector{Float32}, Tuple{Axis{(weight = ViewAxis(1:1, ShapedAxis((1, 1), NamedTuple())), bias = ViewAxis(2:2, ShapedAxis((1, 1), NamedTuple())))}}}, SciMLBase.ChainRulesOriginator, Tuple{}, Colon, NamedTuple{(:verbose,), Tuple{Bool}}})(Δ::Array{Float32, 3})
@ SciMLSensitivity C:\Users\Hossein Pourbozorg\.julia\packages\SciMLSensitivity\dM3nj\src\concrete_solve.jl:501
[7] ZBack
@ C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\compiler\chainrules.jl:211 [inlined]
[8] (::Zygote.var"#208#209"{Tuple{NTuple{4, Nothing}, Tuple{}}, Zygote.ZBack{SciMLSensitivity.var"#adjoint_sensitivity_backpass#276"{Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:verbose,), Tuple{Bool}}}, Nothing, InterpolatingAdjoint{0,false,Val{:central},Bool}, Matrix{Float32}, ComponentVector{Float32, Vector{Float32}, Tuple{Axis{(weight = ViewAxis(1:1, ShapedAxis((1, 1), NamedTuple())), bias = ViewAxis(2:2, ShapedAxis((1, 1), NamedTuple())))}}}, SciMLBase.ChainRulesOriginator, Tuple{}, Colon, NamedTuple{(:verbose,), Tuple{Bool}}}}})(Δ::Array{Float32, 3})
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\lib\lib.jl:206
[9] (::Zygote.var"#2066#back#210"{Zygote.var"#208#209"{Tuple{NTuple{4, Nothing}, Tuple{}}, Zygote.ZBack{SciMLSensitivity.var"#adjoint_sensitivity_backpass#276"{Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:verbose,), Tuple{Bool}}}, Nothing, InterpolatingAdjoint{0,false,Val{:central},Bool}, Matrix{Float32}, ComponentVector{Float32, Vector{Float32}, Tuple{Axis{(weight = ViewAxis(1:1, ShapedAxis((1, 1), NamedTuple())), bias = ViewAxis(2:2, ShapedAxis((1, 1), NamedTuple())))}}}, SciMLBase.ChainRulesOriginator, Tuple{}, Colon, NamedTuple{(:verbose,), Tuple{Bool}}}}}})(Δ::Array{Float32, 3})
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\ZygoteRules\AIbCs\src\adjoint.jl:67 [10] Pullback
@ C:\Users\Hossein Pourbozorg\.julia\packages\DiffEqBase\JH4gt\src\solve.jl:842 [inlined]
[11] (::typeof(∂(#solve#27)))(Δ::Array{Float32, 3})
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\compiler\interface2.jl:0
[12] #208
@ C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\lib\lib.jl:206 [inlined]
[13] #2066#back
@ C:\Users\Hossein Pourbozorg\.julia\packages\ZygoteRules\AIbCs\src\adjoint.jl:67 [inlined]
[14] Pullback
@ C:\Users\Hossein Pourbozorg\.julia\packages\DiffEqBase\JH4gt\src\solve.jl:832 [inlined]
[15] (::typeof(∂(solve)))(Δ::Array{Float32, 3})
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\compiler\interface2.jl:0
[16] #208
@ C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\lib\lib.jl:206 [inlined]
[17] (::Zygote.var"#2066#back#210"{Zygote.var"#208#209"{Tuple{Tuple{Nothing}, Tuple{}}, typeof(∂(solve))}})(Δ::Array{Float32, 3})
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\ZygoteRules\AIbCs\src\adjoint.jl:67 [18] Pullback
@ C:\Users\Hossein Pourbozorg\.julia\packages\ICNF\uY5I4\src\base_icnf.jl:43 [inlined]
[19] (::typeof(∂(#inference#6)))(Δ::Tuple{Vector{Float64}, Vector{Float32}, Vector{Float32}})
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\compiler\interface2.jl:0
[20] Pullback
@ C:\Users\Hossein Pourbozorg\.julia\packages\ICNF\uY5I4\src\base_icnf.jl:27 [inlined]
[21] (::typeof(∂(inference##kw)))(Δ::Tuple{Vector{Float64}, Vector{Float32}, Vector{Float32}})
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\compiler\interface2.jl:0
[22] Pullback
@ C:\Users\Hossein Pourbozorg\.julia\packages\ICNF\uY5I4\src\rnode.jl:208 [inlined]
[23] (::typeof(∂(#loss#59)))(Δ::Float64)
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\compiler\interface2.jl:0
[24] Pullback
@ C:\Users\Hossein Pourbozorg\.julia\packages\ICNF\uY5I4\src\rnode.jl:195 [inlined]
[25] (::typeof(∂(loss)))(Δ::Float64)
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\compiler\interface2.jl:0
[26] Pullback (repeats 2 times)
@ C:\Users\Hossein Pourbozorg\.julia\packages\ICNF\uY5I4\src\rnode.jl:195 [inlined]
[27] Pullback
@ C:\Users\Hossein Pourbozorg\Code Projects\Mine\bug-find\bf-1\bf-1-2.jl:12 [inlined]
[28] (::typeof(∂(diff_loss)))(Δ::Float64)
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\compiler\interface2.jl:0
[29] #208
@ C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\lib\lib.jl:206 [inlined]
[30] (::Zygote.var"#2066#back#210"{Zygote.var"#208#209"{Tuple{Tuple{Nothing}}, typeof(∂(diff_loss))}})(Δ::Float64)
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\ZygoteRules\AIbCs\src\adjoint.jl:67 [31] Pullback
@ .\operators.jl:1035 [inlined]
[32] (::typeof(∂(#_#95)))(Δ::Vector{Float64})
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\compiler\interface2.jl:0
[33] (::Zygote.var"#208#209"{Tuple{Tuple{Nothing, Nothing}, Tuple{Nothing}}, typeof(∂(#_#95))})(Δ::Vector{Float64})
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\lib\lib.jl:206
[34] #2066#back
@ C:\Users\Hossein Pourbozorg\.julia\packages\ZygoteRules\AIbCs\src\adjoint.jl:67 [inlined]
[35] Pullback
@ .\operators.jl:1033 [inlined]
[36] (::typeof(∂(ComposedFunction{typeof(Zygote._jvec), typeof(diff_loss)}(Zygote._jvec, diff_loss))))(Δ::Vector{Float64})
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\compiler\interface2.jl:0
[37] (::Zygote.var"#60#61"{typeof(∂(ComposedFunction{typeof(Zygote._jvec), typeof(diff_loss)}(Zygote._jvec, diff_loss)))})(Δ::Vector{Float64})
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\compiler\interface.jl:45
[38] withjacobian(f::Function, args::ComponentVector{Float32, Vector{Float32}, Tuple{Axis{(weight = ViewAxis(1:1, ShapedAxis((1, 1), NamedTuple())), bias = ViewAxis(2:2, ShapedAxis((1, 1), NamedTuple())))}}})
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\lib\grad.jl:150
[39] jacobian(f::Function, args::ComponentVector{Float32, Vector{Float32}, Tuple{Axis{(weight = ViewAxis(1:1, ShapedAxis((1, 1), NamedTuple())), bias = ViewAxis(2:2, ShapedAxis((1, 1), NamedTuple())))}}})
@ Zygote C:\Users\Hossein Pourbozorg\.julia\packages\Zygote\g2w9o\src\lib\grad.jl:128
[40] top-level scope
@ C:\Users\Hossein Pourbozorg\Code Projects\Mine\bug-find\bf-1\bf-1-2.jl:15
in expression starting at C:\Users\Hossein Pourbozorg\Code Projects\Mine\bug-find\bf-1\bf-1-2.jl:15
If we use ForwardDiffSensitivity
, it works.
icnf = construct(RNODE, nn, 1; compute_mode=ZygoteMatrixMode, sol_kwargs = Dict(:sensealg => ForwardDiffSensitivity()))
Strangely, a smaller dataset makes it work.
r = rand(Float32, 1, 8)
Reported in https://github.com/SciML/SciMLSensitivity.jl/issues/907 and Fixes by https://github.com/SciML/DiffEqBase.jl/pull/937
Code:
Environment: