-
-
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.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "DeepEquilibriumNetworks" | ||
uuid = "6748aba7-0e9b-415e-a410-ae3cc0ecb334" | ||
authors = ["Avik Pal <[email protected]>"] | ||
version = "2.0.0" | ||
version = "2.0.1" | ||
|
||
[deps] | ||
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" | ||
|
@@ -18,11 +18,12 @@ SteadyStateDiffEq = "9672c7b4-1e72-59bd-8a11-6ac3964bc41f" | |
TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77" | ||
|
||
[weakdeps] | ||
LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" | ||
SciMLSensitivity = "1ed8b502-d754-442c-8d5d-10ac956f44a1" | ||
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" | ||
|
||
[extensions] | ||
DeepEquilibriumNetworksSciMLSensitivityExt = "SciMLSensitivity" | ||
DeepEquilibriumNetworksLinearSolveSciMLSensitivityExt = ["LinearSolve", "SciMLSensitivity"] | ||
DeepEquilibriumNetworksZygoteExt = "Zygote" | ||
|
||
[compat] | ||
|
@@ -32,6 +33,7 @@ ConcreteStructs = "0.2" | |
ConstructionBase = "1" | ||
DiffEqBase = "6.119" | ||
LinearAlgebra = "1" | ||
LinearSolve = "2.21.2" | ||
Lux = "0.5.11" | ||
Random = "1" | ||
SciMLBase = "2" | ||
|
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.