-
-
Notifications
You must be signed in to change notification settings - Fork 47
IntervalNonlinearProblem
fails with Zygote
#581
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
Comments
I now get a completely different error when trying to run this. ERROR: UndefVarError: `j` not defined in `Zygote`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/Zygote/1GK3J/src/compiler/interface2.jl:0 [inlined]
[2] (::Zygote.Pullback{Tuple{Core.IntrinsicFunction, UInt64, UInt64}, Tuple{Core.IntrinsicFunction}})(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/1GK3J/src/compiler/interface2.jl:110
[3] <<
@ ./int.jl:529 [inlined]
[4] (::Zygote.Pullback{Tuple{typeof(<<), UInt64, UInt64}, Tuple{Zygote.Pullback{Tuple{…}, Tuple{…}}}})(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/1GK3J/src/compiler/interface2.jl:0
[5] >>
@ ./int.jl:534 [inlined]
[6] (::Zygote.Pullback{Tuple{…}, Tuple{…}})(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/1GK3J/src/compiler/interface2.jl:0
[7] exponent
@ ./math.jl:950 [inlined]
[8] (::Zygote.Pullback{Tuple{typeof(exponent), Float64}, Any})(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/1GK3J/src/compiler/interface2.jl:0
[9] #solve#7
@ ~/.julia/packages/BracketingNonlinearSolve/iO4RJ/src/itp.jl:99 [inlined]
[10] (::Zygote.Pullback{…})(Δ::@NamedTuple{…})
@ Zygote ~/.julia/packages/Zygote/1GK3J/src/compiler/interface2.jl:0
[11] #295
@ ~/.julia/packages/Zygote/1GK3J/src/lib/lib.jl:205 [inlined]
[12] #2169#back
@ ~/.julia/packages/ZygoteRules/CkVIK/src/adjoint.jl:72 [inlined]
[13] solve
@ ~/.julia/packages/BracketingNonlinearSolve/iO4RJ/src/itp.jl:59 [inlined]
[14] (::Zygote.Pullback{…})(Δ::@NamedTuple{…})
@ Zygote ~/.julia/packages/Zygote/1GK3J/src/compiler/interface2.jl:0
[15] #solve#10
@ ~/.julia/packages/BracketingNonlinearSolve/iO4RJ/src/BracketingNonlinearSolve.jl:25 [inlined]
[16] (::Zygote.Pullback{…})(Δ::@NamedTuple{…})
@ Zygote ~/.julia/packages/Zygote/1GK3J/src/compiler/interface2.jl:0
[17] solve
@ ~/.julia/packages/BracketingNonlinearSolve/iO4RJ/src/BracketingNonlinearSolve.jl:24 [inlined]
[18] (::Zygote.Pullback{…})(Δ::@NamedTuple{…})
@ Zygote ~/.julia/packages/Zygote/1GK3J/src/compiler/interface2.jl:0
[19] g
@ ~/Documents/Work/dev/ODETesting/Adjoints/OtherAdjoints/MWE.jl:3 [inlined]
[20] (::Zygote.Pullback{Tuple{…}, Tuple{…}})(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/1GK3J/src/compiler/interface2.jl:0
[21] (::Zygote.var"#78#79"{Zygote.Pullback{Tuple{…}, Tuple{…}}})(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/1GK3J/src/compiler/interface.jl:91
[22] gradient(f::Function, args::Vector{Float64})
@ Zygote ~/.julia/packages/Zygote/1GK3J/src/compiler/interface.jl:148
[23] top-level scope
@ ~/Documents/Work/dev/ODETesting/Adjoints/OtherAdjoints/MWE.jl:5
Some type information was truncated. Use `show(err)` to see complete types. (OtherAdjoints) pkg> st
Status `~/Documents/Work/dev/ODETesting/Adjoints/OtherAdjoints/Project.toml`
[8913a72c] NonlinearSolve v4.8.0
[e88e6eb3] Zygote v0.7.7 @DhairyaLGandhi did something fix the constructor adjoint issues already? Also, any idea on what this Zygote error could be from? |
Looks like this is still failing because of this Zygote issue: FluxML/Zygote.jl#1573 |
No, that means it's not hitting an adjoint overload. That's not a Zygote issue. |
So it shouldn't be trying to take the adjoint of |
correct |
That is inside of ITP. Seeing that error means you're differentiating the algorithm not using a custom adjoint. For other nonlinear problems, it catches here https://github.com/SciML/DiffEqBase.jl/blob/master/src/solve.jl#L1173 by https://github.com/SciML/DiffEqBase.jl/blob/master/ext/DiffEqBaseChainRulesCoreExt.jl#L22, because of the weird quirk that julia> NonlinearProblem <: SciMLBase.AbstractDEProblem
true But the bracketing methods directly catch solve https://github.com/SciML/NonlinearSolve.jl/blob/master/lib/BracketingNonlinearSolve/src/itp.jl#L59 so that isn't hit. So BracketingNonlinearSolve needs to refactor to have a lowering stage to make For BacketingNonlinearSolve, |
Ok cool, I think I'm beginning to understand. Essentially I need to make it so that there's a
Nevermind, |
You cannot differentiate w.r.t. |
Description of the bug 🐞
IntervalNonlinearProblem
fails withZygote
as shown in the MWE below.Presumably, it is hitting the
AbstractNonlinearProblem
and looking for theu0
. @ChrisRackauckas thinks we specializedIntervalNonlinearProblem
with forward mode by maybe missed something around reverse mode optimizations there.Minimal Reproducible Example 👇
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
The text was updated successfully, but these errors were encountered: