Skip to content

Commit

Permalink
Merge pull request #155 from SciML/ap/fix_again
Browse files Browse the repository at this point in the history
Update to new Lux API
  • Loading branch information
avik-pal committed Jun 24, 2024
2 parents dbcad8d + f8ea1a6 commit 6151692
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Project.toml
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 <avikpal@mit.edu>"]
version = "2.1.1"
version = "2.1.2"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down Expand Up @@ -41,7 +41,7 @@ FastClosures = "0.3"
ForwardDiff = "0.10.36"
Functors = "0.4.10"
LinearSolve = "2.21.2"
Lux = "0.5.50"
Lux = "0.5.56"
LuxCUDA = "0.3.2"
LuxCore = "0.1.14"
LuxTestUtils = "0.1.15"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/reduced_dim_deq.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function construct_model(solver; model_type::Symbol=:regdeq)
else
# This should preferably done via `ChainRulesCore.@ignore_derivatives`. But here
# we are only using Zygote so this is fine.
init = WrappedFunction(x -> Zygote.@ignore(fill!(
init = WrappedFunction{:direct_call}(x -> Zygote.@ignore(fill!(
similar(x, 128, size(x, 2)), false)))
end
Expand Down
9 changes: 5 additions & 4 deletions src/layers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Deep Equilibrium Network as proposed in [baideep2019](@cite) and [pal2022mixing]
- `init`: Initial Condition for the rootfinding problem. If `nothing`, the initial
condition is set to `zero(x)`. If `missing`, the initial condition is set to
`WrappedFunction(zero)`. In other cases the initial condition is set to
`WrappedFunction{:direct_call}(zero)`. In other cases the initial condition is set to
`init(x, ps, st)`.
- `jacobian_regularization`: Must be one of `nothing`, `AutoForwardDiff`, `AutoFiniteDiff`
or `AutoZygote`.
Expand All @@ -160,8 +160,8 @@ julia> model = DeepEquilibriumNetwork(
DeepEquilibriumNetwork(
model = Parallel(
+
Dense(2 => 2, bias=false), # 4 parameters
Dense(2 => 2, bias=false), # 4 parameters
layer_1 = Dense(2 => 2, bias=false), # 4 parameters
layer_2 = Dense(2 => 2, bias=false), # 4 parameters
),
init = WrappedFunction(Base.Fix1{typeof(DeepEquilibriumNetworks.__zeros_init), Nothing}(DeepEquilibriumNetworks.__zeros_init, nothing)),
) # Total: 8 parameters,
Expand All @@ -184,7 +184,8 @@ function DeepEquilibriumNetwork(
model isa AbstractExplicitLayer || (model = Lux.transform(model))

if init === missing # Regular DEQ
init = WrappedFunction(Base.Fix1(__zeros_init, __getproperty(model, Val(:scales))))
init = WrappedFunction{:direct_call}(Base.Fix1(
__zeros_init, __getproperty(model, Val(:scales))))
elseif init === nothing # SkipRegDEQ
init = NoOpLayer()
elseif !(init isa AbstractExplicitLayer)
Expand Down

2 comments on commit 6151692

@avik-pal
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

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/109642

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.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

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:

git tag -a v2.1.2 -m "<description of version>" 61516929626024351621666bfbf1d6897d67722b
git push origin v2.1.2

Please sign in to comment.