Skip to content

Commit c10ae92

Browse files
committed
fix vec
1 parent 1845c9a commit c10ae92

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/mcmc/ess.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ function AbstractMCMC.step(
8989
return transition, TuringESSState(vi, state.priors)
9090
end
9191

92+
_vec(x::Real) = [x]
93+
_vec(x::AbstractArray) = vec(x)
94+
9295
# Prior distribution of considered random variable
9396
struct ESSPrior{M<:Model,V<:AbstractVarInfo,T}
9497
model::M
@@ -103,7 +106,7 @@ struct ESSPrior{M<:Model,V<:AbstractVarInfo,T}
103106
EllipticalSliceSampling.isgaussian(typeof(prior_dist)) || error(
104107
"[ESS] only supports Gaussian prior distributions, but found $(typeof(prior_dist))",
105108
)
106-
vec(mean(prior_dist))
109+
_vec(mean(prior_dist))
107110
end
108111
return new{typeof(model),typeof(varinfo),typeof(μ)}(model, varinfo, μ)
109112
end

0 commit comments

Comments
 (0)