Skip to content

Commit 3a49d8d

Browse files
committed
Actually fix submodel evaluate
1 parent acb02e1 commit 3a49d8d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/fastldf.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ struct OnlyAccsVarInfo{Accs<:AccumulatorTuple} <: AbstractVarInfo
22
accs::Accs
33
end
44
DynamicPPL.getaccs(vi::OnlyAccsVarInfo) = vi.accs
5-
DynamicPPL.maybe_invlink_before_eval!!(vi::OnlyAccsVarInfo, ::Model) = vi
65
DynamicPPL.setaccs!!(::OnlyAccsVarInfo, accs::AccumulatorTuple) = OnlyAccsVarInfo(accs)
76

87
struct RangeAndLinked
@@ -133,11 +132,13 @@ struct FastLDF{
133132
end
134133
end
135134

136-
function _evaluate!!(
137-
model::Model{F,A,D,M,TA,TD,<:FastLDFContext}, varinfo::OnlyAccsVarInfo
138-
) where {F,A,D,M,TA,TD}
139-
args = map(maybe_deepcopy, model.args)
140-
return model.f(model, varinfo, args...; model.defaults...)
135+
function _evaluate!!(model::Model, varinfo::OnlyAccsVarInfo)
136+
if leafcontext(model.context) isa FastLDFContext
137+
args = map(maybe_deepcopy, model.args)
138+
return model.f(model, varinfo, args...; model.defaults...)
139+
else
140+
error("Shouldn't happen")
141+
end
141142
end
142143
maybe_deepcopy(@nospecialize(x)) = x
143144
function maybe_deepcopy(x::AbstractArray{T}) where {T}

0 commit comments

Comments
 (0)