Skip to content

Commit 92772b5

Browse files
committed
Split up tilde_observe!! for Distribution / Submodel
1 parent 07e01cf commit 92772b5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/context_implementations.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ accumulate the log probability, and return the observed value and updated `vi`.
6060
Falls back to `tilde_observe!!(context, right, left, vi)` ignoring the information about variable name
6161
and indices; if needed, these can be accessed through this function, though.
6262
"""
63-
function tilde_observe!!(::DefaultContext, right, left, vn, vi)
64-
right isa DynamicPPL.Submodel &&
65-
throw(ArgumentError("`x ~ to_submodel(...)` is not supported when `x` is observed"))
63+
function tilde_observe!!(::DefaultContext, right::Distribution, left, vn, vi)
6664
vi = accumulate_observe!!(vi, right, left, vn)
6765
return left, vi
6866
end
67+
68+
function tilde_observe!!(::DefaultContext, ::DynamicPPL.Submodel, left, vn, vi)
69+
throw(ArgumentError("`x ~ to_submodel(...)` is not supported when `x` is observed"))
70+
end

0 commit comments

Comments
 (0)