@@ -166,15 +166,23 @@ struct Transition{T,F<:AbstractFloat,N<:NamedTuple} <: AbstractTransition
166
166
logprior = DynamicPPL. getlogprior (vi)
167
167
loglikelihood = DynamicPPL. getloglikelihood (vi)
168
168
169
- # Convert values to the format needed (with individual VarNames split up).
170
- # TODO (penelopeysm): This wouldn't be necessary if not for MCMCChains's poor
171
- # representation...
172
- iters = map (
173
- DynamicPPL. varname_and_value_leaves,
174
- keys (vals_as_in_model),
175
- values (vals_as_in_model),
176
- )
177
- values_split = mapreduce (collect, vcat, iters)
169
+ # Convert values to the format needed (i.e. a Vector of (varname,
170
+ # value) tuples, where value isa Real: all vector-valued varnames must
171
+ # be split up.)
172
+ # TODO (penelopeysm): This wouldn't be necessary if not for MCMCChains's
173
+ # poor representation...
174
+ values_split = if isempty (vals_as_in_model)
175
+ # If there are no values, we return an empty vector.
176
+ # This is the case for models with no parameters.
177
+ Vector {Tuple{VarName,Any}} ()
178
+ else
179
+ iters = map (
180
+ DynamicPPL. varname_and_value_leaves,
181
+ keys (vals_as_in_model),
182
+ values (vals_as_in_model),
183
+ )
184
+ mapreduce (collect, vcat, iters)
185
+ end
178
186
179
187
# Get additional statistics
180
188
stats = getstats (sampler_transition)
0 commit comments