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

fix unbound type parameters in NTuple #112

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/layers/mdeq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@
end

function MultiScaleDeepEquilibriumNetwork(main_layers::Tuple, mapping_layers::Matrix,
post_fuse_layer::Union{Nothing, Tuple}, solver, scales::NTuple{N, NTuple{L, Int64}};
sensealg=SteadyStateAdjoint(), kwargs...) where {N, L}
post_fuse_layer::Union{Nothing, Tuple}, solver,
scales::Tuple{NTuple{L, Int64}, Vararg{NTuple{L, Int64}, nMinus1}};
sensealg=SteadyStateAdjoint(), kwargs...) where {nMinus1, L}
l1 = Parallel(nothing, main_layers...)
l2 = BranchLayer(Parallel.(+, map(x -> tuple(x...), eachrow(mapping_layers))...)...)

Expand Down Expand Up @@ -226,8 +227,9 @@

function MultiScaleSkipDeepEquilibriumNetwork(main_layers::Tuple, mapping_layers::Matrix,
post_fuse_layer::Union{Nothing, Tuple}, shortcut_layers::Union{Nothing, Tuple},
solver, scales::NTuple{N, NTuple{L, Int64}};
sensealg=SteadyStateAdjoint(), kwargs...) where {N, L}
solver,
scales::Tuple{NTuple{L, Int64}, Vararg{NTuple{L, Int64}, nMinus1}};
sensealg=SteadyStateAdjoint(), kwargs...) where {nMinus1, L}
l1 = Parallel(nothing, main_layers...)
l2 = BranchLayer(Parallel.(+, map(x -> tuple(x...), eachrow(mapping_layers))...)...)
shortcut = shortcut_layers === nothing ? nothing : Parallel(nothing, shortcut_layers...)
Expand Down Expand Up @@ -330,8 +332,9 @@
See also: [`DeepEquilibriumNetwork`](@ref), [`SkipDeepEquilibriumNetwork`](@ref), [`MultiScaleDeepEquilibriumNetwork`](@ref), [`MultiScaleSkipDeepEquilibriumNetwork`](@ref)
"""
function MultiScaleNeuralODE(main_layers::Tuple, mapping_layers::Matrix,
post_fuse_layer::Union{Nothing, Tuple}, solver, scales::NTuple{N, NTuple{L, Int64}};
sensealg=GaussAdjoint(; autojacvec=ZygoteVJP()), kwargs...) where {N, L}
post_fuse_layer::Union{Nothing, Tuple}, solver,
scales::Tuple{NTuple{L, Int64}, Vararg{NTuple{L, Int64}, nMinus1}};
sensealg=GaussAdjoint(; autojacvec=ZygoteVJP()), kwargs...) where {nMinus1, L}
l1 = Parallel(nothing, main_layers...)
l2 = BranchLayer(Parallel.(+, map(x -> tuple(x...), eachrow(mapping_layers))...)...)

Expand All @@ -344,7 +347,7 @@
split_idxs, scales)
end

return MultiScaleNeuralODE{N}(model, solver, sensealg, scales, split_idxs, kwargs)
return MultiScaleNeuralODE{nMinus1+1}(model, solver, sensealg, scales, split_idxs, kwargs)

Check warning on line 350 in src/layers/mdeq.jl

View check run for this annotation

Codecov / codecov/patch

src/layers/mdeq.jl#L350

Added line #L350 was not covered by tests
end

_jacobian_regularization(::MultiScaleNeuralODE) = false
Expand Down
2 changes: 1 addition & 1 deletion test/qa.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ using DeepEquilibriumNetworks, Aqua
Aqua.test_piracies(DeepEquilibriumNetworks; broken=true)
Aqua.test_project_extras(DeepEquilibriumNetworks)
Aqua.test_stale_deps(DeepEquilibriumNetworks)
Aqua.test_unbound_args(DeepEquilibriumNetworks; broken=true)
Aqua.test_unbound_args(DeepEquilibriumNetworks)
Aqua.test_undefined_exports(DeepEquilibriumNetworks; broken=true)
end
Loading