-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from SciML/ap/defaults
Default to using SimpleGMRES for the backward pass
- Loading branch information
Showing
4 changed files
with
60 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
ext/DeepEquilibriumNetworksLinearSolveSciMLSensitivityExt.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module DeepEquilibriumNetworksLinearSolveSciMLSensitivityExt | ||
|
||
# Linear Solve is a dependency of SciMLSensitivity, so we only need to load SciMLSensitivity | ||
# to load this extension | ||
using LinearSolve, SciMLBase, SciMLSensitivity | ||
import DeepEquilibriumNetworks: __default_sensealg | ||
|
||
@inline function __default_sensealg(prob::SteadyStateProblem) | ||
# We want to avoid the cost for cache construction for linsolve = nothing | ||
# For small problems we should use concrete jacobian but we assume users want to solve | ||
# large problems with this package so we default to GMRES and avoid runtime dispatches | ||
linsolve = SimpleGMRES{true}(; blocksize=prod(size(prob.u0)[1:(end - 1)])) | ||
linsolve_kwargs = (; maxiters=10, abstol=1e-3, reltol=1e-3) | ||
return SteadyStateAdjoint(; linsolve, linsolve_kwargs, autojacvec=ZygoteVJP()) | ||
end | ||
@inline __default_sensealg(::ODEProblem) = GaussAdjoint(; autojacvec=ZygoteVJP()) | ||
|
||
end |
This file was deleted.
Oops, something went wrong.
f055519
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
f055519
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/97635
Tip: Release Notes
Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.
To add them here just re-invoke and the PR will be updated.
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: