Skip to content

Commit facab4a

Browse files
Fix method overwriting: merge DeepSplitting constructors
The two separate constructors for Flux.Optimise and Optimisers.jl were causing a method overwriting error during precompilation. Merged into a single constructor that works with both optimizer types since the _get_eta helper already dispatches correctly for both types.
1 parent f422bbc commit facab4a

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

src/DeepSplitting.jl

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,30 +48,14 @@ struct DeepSplitting{NN, F, O, L, MCS} <: HighDimPDEAlgorithm
4848
mc_sample!::MCS # Monte Carlo sample
4949
end
5050

51-
# Constructor for old-style Flux.Optimise optimizers
51+
# Single constructor that works with both Flux.Optimise and Optimisers.jl optimizers
5252
function DeepSplitting(
5353
nn;
5454
K = 1,
55-
opt::O = Flux.Optimise.Adam(0.01),
55+
opt = Flux.Optimise.Adam(0.01),
5656
λs::L = nothing,
5757
mc_sample = NoSampling()
5858
) where {
59-
O <: Flux.Optimise.AbstractOptimiser,
60-
L <: Union{Nothing, Vector{N}} where {N <: Number},
61-
}
62-
isnothing(λs) ? λs = [_get_eta(opt)] : nothing
63-
return DeepSplitting(nn, K, opt, λs, mc_sample)
64-
end
65-
66-
# Constructor for new-style Optimisers.jl optimizers
67-
function DeepSplitting(
68-
nn;
69-
K = 1,
70-
opt::O,
71-
λs::L = nothing,
72-
mc_sample = NoSampling()
73-
) where {
74-
O <: Optimisers.AbstractRule,
7559
L <: Union{Nothing, Vector{N}} where {N <: Number},
7660
}
7761
isnothing(λs) ? λs = [_get_eta(opt)] : nothing

0 commit comments

Comments
 (0)