From bcbe11d251a762c3d1c360bb1c5e1dc158922115 Mon Sep 17 00:00:00 2001 From: Ray Kim Date: Thu, 13 Jun 2024 22:58:01 +0100 Subject: [PATCH] fix bug --- src/utils.jl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/utils.jl b/src/utils.jl index a8039b22..3ae59a78 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -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( @@ -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)