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

some tests to check concrete_solve use #258

Merged
merged 4 commits into from
May 25, 2020

Conversation

frankschae
Copy link
Member

@ChrisRackauckas do you have an idea why ReverseDiff below doesn't work? Here is the stacktrace:

julia> ReverseDiff.gradient((u0,p)->sum(concrete_solve(proboop,EulerHeun(),u0,p,dt=1e-2,adaptive=false,save_noise=true,saveat=0.01)),u0,p)
ERROR: MethodError: no method matching gradient(::var"#57#58", ::Array{Float64,1}, ::Array{Float64,1})
Closest candidates are:
  gradient(::Any, ::Any) at /Users/frank/.julia/packages/ReverseDiff/uy0uk/src/api/gradients.jl:22
  gradient(::Any, ::Any, ::ReverseDiff.GradientConfig) at /Users/frank/.julia/packages/ReverseDiff/uy0uk/src/api/gradients.jl:22
Stacktrace:
 [1] top-level scope at none:0

I also realized that inplace versions don't work yet and opened an issue. Will solve that tomorrow.

#Random.seed!(seed)
du01,dp1 = ReverseDiff.gradient((u0,p)->sum(concrete_solve(proboop,EulerHeun(),u0,p,dt=1e-2,adaptive=false,save_noise=true,saveat=0.01)),(u0,p))
Random.seed!(seed)
du04,dp4 = ReverseDiff.gradient((u0,p)->sum(concrete_solve(proboop,EulerHeun(),u0,p,dt=1e-2,adaptive=false,save_noise=true,abstol=1e-14,reltol=1e-14,saveat=0.01)),(u0,p))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed dt methods ignore the tolerances.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, I thought the error from CI points in this direction: https://travis-ci.org/github/SciML/DiffEqSensitivity.jl/jobs/690732450 "got unsupported keyword arguments "checkpoints", "abstol", "reltol""

A bit strange is that in my local environment with the same tracker version the tracker one at least runs without any error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh updated my DiffEqBase master and I now get the same error.. seems to be related to this change:
SciML/DiffEqBase.jl@562205d

@ChrisRackauckas
Copy link
Member

https://travis-ci.org/github/SciML/DiffEqSensitivity.jl/jobs/690732450#L686

You haven't implemented InterpolatingAdjoint for SDEs yet.



Random.seed!(seed)
du03,dp3 = Tracker.gradient((u0,p)->sum(concrete_solve(proboop,EulerHeun(),u0,p,dt=1e-2,adaptive=false,save_noise=true,abstol=1e-14,reltol=1e-14,saveat=0.01)),u0,p)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
du03,dp3 = Tracker.gradient((u0,p)->sum(concrete_solve(proboop,EulerHeun(),u0,p,dt=1e-2,adaptive=false,save_noise=true,abstol=1e-14,reltol=1e-14,saveat=0.01)),u0,p)
du03,dp3 = Tracker.gradient((u0,p)->sum(concrete_solve(proboop,EulerHeun(),u0,p,dt=1e-2,adaptive=false,save_noise=true,abstol=1e-14,reltol=1e-14,saveat=0.01,sensealg=BacksolveAdjoint())),u0,p)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! Also just saw it from the nicer looking stacktrace in Juno.. but I think I misunderstood then Tracker.gradient so this also always uses the adjoints? I thought this will simply backprop through the operations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They got adjoint definitions to call into this now.

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 this pull request may close these issues.

None yet

2 participants