Skip to content

Commit 92c84b5

Browse files
committed
Fix get_param_eltype for context stacks
1 parent d7c29f6 commit 92c84b5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/model.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,13 +1024,14 @@ metadata field.
10241024
For InitContext, it's quite different: because InitContext is responsible for supplying the
10251025
parameters, we can avoid using `eltype(varinfo)` and instead query the parameters inside it.
10261026
"""
1027-
get_param_eltype(vi::AbstractVarInfo, ::DefaultContext) = eltype(vi)
1028-
function get_param_eltype(vi::AbstractVarInfo, ctx::AbstractContext)
1027+
function get_param_eltype(vi::AbstractVarInfo, ctx::AbstractParentContext)
10291028
return get_param_eltype(vi, DynamicPPL.childcontext(ctx))
10301029
end
1030+
get_param_eltype(vi::AbstractVarInfo, ::AbstractContext) = eltype(vi)
10311031
function get_param_eltype(::AbstractVarInfo, ctx::InitContext)
10321032
return _get_strat_param_eltype(ctx.strategy)
10331033
end
1034+
10341035
function _get_strat_param_eltype(strategy::InitFromParams{<:VectorWithRanges})
10351036
return eltype(strategy.params.vect)
10361037
end

0 commit comments

Comments
 (0)