Skip to content

Commit c33eeae

Browse files
authored
Defer acclogp_assume!! and acclogp_observe!! to child context (#574)
* defer `acclogp_assume!!` and `acclogp_observe!!` to child context if not overloaded * bump patch version
1 parent c1d3636 commit c33eeae

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DynamicPPL"
22
uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8"
3-
version = "0.24.5"
3+
version = "0.24.6"
44

55
[deps]
66
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"

src/context_implementations.jl

+12
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,22 @@ require_particles(spl::Sampler) = false
1616

1717
# Allows samplers, etc. to hook into the final logp accumulation in the tilde-pipeline.
1818
function acclogp_assume!!(context::AbstractContext, vi::AbstractVarInfo, logp)
19+
return acclogp_assume!!(NodeTrait(acclogp_assume!!, context), context, vi, logp)
20+
end
21+
function acclogp_assume!!(::IsParent, context::AbstractContext, vi::AbstractVarInfo, logp)
22+
return acclogp_assume!!(childcontext(context), vi, logp)
23+
end
24+
function acclogp_assume!!(::IsLeaf, context::AbstractContext, vi::AbstractVarInfo, logp)
1925
return acclogp!!(context, vi, logp)
2026
end
2127

2228
function acclogp_observe!!(context::AbstractContext, vi::AbstractVarInfo, logp)
29+
return acclogp_observe!!(NodeTrait(acclogp_observe!!, context), context, vi, logp)
30+
end
31+
function acclogp_observe!!(::IsParent, context::AbstractContext, vi::AbstractVarInfo, logp)
32+
return acclogp_observe!!(childcontext(context), vi, logp)
33+
end
34+
function acclogp_observe!!(::IsLeaf, context::AbstractContext, vi::AbstractVarInfo, logp)
2335
return acclogp!!(context, vi, logp)
2436
end
2537

0 commit comments

Comments
 (0)