Skip to content

Commit

Permalink
Allow debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Sep 25, 2023
1 parent dda196c commit 1903cfa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
15 changes: 12 additions & 3 deletions src/layers/mdeq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ end
u, x = z
u_ = split_and_reshape(u, m.split_idxs, m.scales)
u_res, st = m.model(($(inputs...),), ps, st)
return vcat(flatten.(u_res)...), st
return mapreduce(flatten, vcat, u_res), st
end
end

Expand Down Expand Up @@ -80,6 +80,10 @@ See also: [`DeepEquilibriumNetwork`](@ref), [`SkipDeepEquilibriumNetwork`](@ref)
kwargs
end

function MultiScaleDeepEquilibriumNetwork(model::MultiScaleInputLayer{N}, args...) where {N}
return MultiScaleDeepEquilibriumNetwork{N}(model, args...)
end

@truncate_stacktrace MultiScaleDeepEquilibriumNetwork 1 3

function Lux.initialstates(rng::AbstractRNG, deq::MultiScaleDeepEquilibriumNetwork)
Expand All @@ -104,7 +108,7 @@ function MultiScaleDeepEquilibriumNetwork(main_layers::Tuple, mapping_layers::Ma
split_idxs, scales)
end

return MultiScaleDeepEquilibriumNetwork{N}(model, solver, sensealg, scales, split_idxs,
return MultiScaleDeepEquilibriumNetwork(model, solver, sensealg, scales, split_idxs,
kwargs)
end

Expand Down Expand Up @@ -205,6 +209,11 @@ See also: [`DeepEquilibriumNetwork`](@ref), [`SkipDeepEquilibriumNetwork`](@ref)
kwargs
end

function MultiScaleSkipDeepEquilibriumNetwork(model::MultiScaleInputLayer{N},
args...) where {N}
return MultiScaleSkipDeepEquilibriumNetwork{N}(model, args...)
end

@truncate_stacktrace MultiScaleSkipDeepEquilibriumNetwork 1 3 4

function Lux.initialstates(rng::AbstractRNG, deq::MultiScaleSkipDeepEquilibriumNetwork)
Expand All @@ -231,7 +240,7 @@ function MultiScaleSkipDeepEquilibriumNetwork(main_layers::Tuple, mapping_layers
split_idxs, scales)
end

return MultiScaleSkipDeepEquilibriumNetwork{N}(model, shortcut, solver, sensealg,
return MultiScaleSkipDeepEquilibriumNetwork(model, shortcut, solver, sensealg,
scales, split_idxs, kwargs)
end

Expand Down
3 changes: 2 additions & 1 deletion src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ end

@truncate_stacktrace EquilibriumSolution 1 2

function DiffEqBase.__solve(prob::AbstractSteadyStateProblem, alg::AbstractDEQSolver,
function SciMLBase.__solve(prob::AbstractSteadyStateProblem, alg::AbstractDEQSolver,
args...; kwargs...)
# FIXME: Remove this handle
sol = solve(prob, alg.alg, args...; kwargs...)

u, du, retcode = sol.u, sol.resid, sol.retcode
Expand Down

0 comments on commit 1903cfa

Please sign in to comment.