Skip to content

Commit c32d112

Browse files
committed
Remove tilde_assume as well
1 parent 92a7670 commit c32d112

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/context_implementations.jl

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# assume
2-
function tilde_assume(context::AbstractContext, args...)
3-
return tilde_assume(childcontext(context), args...)
2+
function tilde_assume!!(context::AbstractContext, right::Distribution, vn, vi)
3+
return tilde_assume!!(childcontext(context), right, vn, vi)
44
end
5-
function tilde_assume(::DefaultContext, right, vn, vi)
5+
function tilde_assume!!(::DefaultContext, right::Distribution, vn, vi)
66
y = getindex_internal(vi, vn)
77
f = from_maybe_linked_internal_transform(vi, vn, right)
88
x, logjac = with_logabsdet_jacobian(f, y)
99
vi = accumulate_assume!!(vi, x, logjac, vn, right)
1010
return x, vi
1111
end
12-
function tilde_assume(context::PrefixContext, right, vn, vi)
12+
function tilde_assume!!(context::PrefixContext, right::Distribution, vn, vi)
1313
# Note that we can't use something like this here:
1414
# new_vn = prefix(context, vn)
1515
# return tilde_assume(childcontext(context), right, new_vn, vi)
@@ -20,7 +20,7 @@ function tilde_assume(context::PrefixContext, right, vn, vi)
2020
# would apply the prefix `b._`, resulting in `b.a.b._`.
2121
# This is why we need a special function, `prefix_and_strip_contexts`.
2222
new_vn, new_context = prefix_and_strip_contexts(context, vn)
23-
return tilde_assume(new_context, right, new_vn, vi)
23+
return tilde_assume!!(new_context, right, new_vn, vi)
2424
end
2525

2626
"""
@@ -32,12 +32,8 @@ accumulate the log probability, and return the sampled value and updated `vi`.
3232
By default, calls `tilde_assume(context, right, vn, vi)` and accumulates the log
3333
probability of `vi` with the returned value.
3434
"""
35-
function tilde_assume!!(context, right, vn, vi)
36-
return if right isa DynamicPPL.Submodel
37-
_evaluate!!(right, vi, context, vn)
38-
else
39-
tilde_assume(context, right, vn, vi)
40-
end
35+
function tilde_assume!!(context, right::DynamicPPL.Submodel, vn, vi)
36+
return _evaluate!!(right, vi, context, vn)
4137
end
4238

4339
# observe

0 commit comments

Comments
 (0)