Skip to content

Commit e75fd1e

Browse files
authored
Implement missing tilde_assume method (#904)
1 parent 6cd439d commit e75fd1e

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

HISTORY.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# DynamicPPL Changelog
22

3+
## 0.36.1
4+
5+
Fixed a missing method for `tilde_assume`.
6+
37
## 0.36.0
48

59
**Breaking changes**

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.36.0"
3+
version = "0.36.1"
44

55
[deps]
66
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"

src/context_implementations.jl

+7
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function tilde_assume(context::AbstractContext, args...)
5757
return tilde_assume(NodeTrait(tilde_assume, context), context, args...)
5858
end
5959
function tilde_assume(::IsLeaf, context::AbstractContext, right, vn, vi)
60+
# no rng nor sampler
6061
return assume(right, vn, vi)
6162
end
6263
function tilde_assume(::IsParent, context::AbstractContext, args...)
@@ -69,11 +70,17 @@ end
6970
function tilde_assume(
7071
::IsLeaf, rng::Random.AbstractRNG, context::AbstractContext, sampler, right, vn, vi
7172
)
73+
# rng and sampler
7274
return assume(rng, sampler, right, vn, vi)
7375
end
76+
function tilde_assume(::IsLeaf, context::AbstractContext, sampler, right, vn, vi)
77+
# sampler but no rng
78+
return assume(Random.default_rng(), sampler, right, vn, vi)
79+
end
7480
function tilde_assume(
7581
::IsParent, rng::Random.AbstractRNG, context::AbstractContext, args...
7682
)
83+
# rng but no sampler
7784
return tilde_assume(rng, childcontext(context), args...)
7885
end
7986

0 commit comments

Comments
 (0)