Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Red-Portal committed Jun 13, 2024
1 parent e9b9609 commit bcbe11d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ function maybe_init_optimizer(
optimizer ::Optimisers.AbstractRule,
params
)
haskey(state_init, :optimizer) ?
state_init.optimizer : Optimisers.setup(optimizer, params)
if haskey(state_init, :optimizer)
state_init.optimizer
else
Optimisers.setup(optimizer, params)
end
end

function maybe_init_objective(
Expand All @@ -20,8 +23,11 @@ function maybe_init_objective(
params,
restructure
)
haskey(state_init, :objective) ?
state_init.objective : init(rng, objective, params, problem, restructure)
if haskey(state_init, :objective)
state_init.objective
else
init(rng, objective, problem, params, restructure)
end
end

eachsample(samples::AbstractMatrix) = eachcol(samples)
Expand Down

0 comments on commit bcbe11d

Please sign in to comment.