Skip to content

Commit cba22b1

Browse files
committed
Update docstrings
1 parent 11c55d3 commit cba22b1

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

src/context_implementations.jl

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,12 @@ function tilde(ctx::MiniBatchContext, sampler, right, left::VarName, inds, vi)
3636
end
3737

3838
"""
39-
tilde_assume(ctx, sampler, right, vn, inds, vi) -> sampled value
39+
tilde_assume(ctx, sampler, right, vn, inds, vi)
4040
41-
This method is applied in the generated code for assumed variables, e.g., `x ~ Normal()` where
42-
`x` does not occur in the model inputs.
41+
Handles assumed variables, e.g., `x ~ Normal()` (where `x` does occur in the model inputs),
42+
accumulates the log probability, and returns the sampled value.
4343
44-
Falls back to `tilde(ctx, sampler, right, vn, inds, vi)`, but automatically accumulates the
45-
log-probability and returns only the sampled value.
44+
Falls back to `tilde(ctx, sampler, right, vn, inds, vi)`.
4645
"""
4746
function tilde_assume(ctx, sampler, right, vn, inds, vi)
4847
value, logp = tilde(ctx, sampler, right, vn, inds, vi)
@@ -73,14 +72,13 @@ function tilde(ctx::MiniBatchContext, sampler, right, left, vi)
7372
end
7473

7574
"""
76-
tilde_observe(ctx, sampler, right, left, vname, vinds, vi) -> observed value
75+
tilde_observe(ctx, sampler, right, left, vname, vinds, vi)
7776
78-
This method is applied in the generated code for observed variables, e.g., `x ~ Normal()` where
79-
`x` does occur in the model inputs.
77+
Handles observed variables, e.g., `x ~ Normal()` (where `x` does occur in the model inputs),
78+
accumulates the log probability, and returns the observed value.
8079
8180
Falls back to `tilde(ctx, sampler, right, left, vi)` ignoring the information about variable name
82-
and indices; if needed, these can be accessed through this function, though. Automatically
83-
accumulates the log-probability and returns only the observed value.
81+
and indices; if needed, these can be accessed through this function, though.
8482
"""
8583
function tilde_observe(ctx, sampler, right, left, vname, vinds, vi)
8684
logp = tilde(ctx, sampler, right, left, vi)
@@ -89,11 +87,12 @@ function tilde_observe(ctx, sampler, right, left, vname, vinds, vi)
8987
end
9088

9189
"""
92-
tilde_observe(ctx, sampler, right, left, vi) -> observed value
90+
tilde_observe(ctx, sampler, right, left, vi)
9391
94-
This method is applied in the generated code for observed constants, e.g., `1.0 ~ Normal()`.
95-
Falls back to `tilde(ctx, sampler, right, left, vi)`. Automatically accumulates the log-probability
96-
and returns only the observed value.
92+
Handles observed constants, e.g., `1.0 ~ Normal()`, accumulates the log probability, and returns the
93+
observed value.
94+
95+
Falls back to `tilde(ctx, sampler, right, left, vi)`.
9796
"""
9897
function tilde_observe(ctx, sampler, right, left, vi)
9998
logp = tilde(ctx, sampler, right, left, vi)
@@ -198,13 +197,12 @@ function dot_tilde(
198197
end
199198

200199
"""
201-
dot_tilde_assume(ctx, sampler, right, left, vn, inds, vi) -> sampled value
200+
dot_tilde_assume(ctx, sampler, right, left, vn, inds, vi)
202201
203-
This method is applied in the generated code for assumed vectorized variables, e.g., `x .~
204-
MvNormal()` where `x` does not occur in the model inputs.
202+
Handles broadcasted assumed variables, e.g., `x .~ MvNormal()` (where `x` does not occur in the
203+
model inputs), accumulates the log probability, and returns the sampled value.
205204
206-
Falls back to `dot_tilde(ctx, sampler, right, left, vn, inds, vi)`, but automatically accumulates
207-
the log-probability and returns only the sampled value.
205+
Falls back to `dot_tilde(ctx, sampler, right, left, vn, inds, vi)`.
208206
"""
209207
function dot_tilde_assume(ctx, sampler, right, left, vn, inds, vi)
210208
value, logp = dot_tilde(ctx, sampler, right, left, vn, inds, vi)
@@ -377,14 +375,13 @@ function dot_tilde(ctx::MiniBatchContext, sampler, right, left, vi)
377375
end
378376

379377
"""
380-
dot_tilde_observe(ctx, sampler, right, left, vname, vinds, vi) -> observed value
378+
dot_tilde_observe(ctx, sampler, right, left, vname, vinds, vi)
381379
382-
This method is applied in the generated code for vectorized observed variables, e.g., `x .~
383-
MvNormal()` where `x` does occur the model inputs.
380+
Handles broadcasted observed values, e.g., `x .~ MvNormal()` (where `x` does occur the model inputs),
381+
accumulates the log probability, and returns the observed value.
384382
385383
Falls back to `dot_tilde(ctx, sampler, right, left, vi)` ignoring the information about variable
386-
name and indices; if needed, these can be accessed through this function, though. Automatically
387-
accumulates the log-probability and returns only the observed value.
384+
name and indices; if needed, these can be accessed through this function, though.
388385
"""
389386
function dot_tilde_observe(ctx, sampler, right, left, vn, inds, vi)
390387
logp = dot_tilde(ctx, sampler, right, left, vi)
@@ -393,11 +390,12 @@ function dot_tilde_observe(ctx, sampler, right, left, vn, inds, vi)
393390
end
394391

395392
"""
396-
dot_tilde_observe(ctx, sampler, right, left, vi) -> observed value
393+
dot_tilde_observe(ctx, sampler, right, left, vi)
394+
395+
Handles broadcasted observed constants, e.g., `[1.0] .~ MvNormal()`, accumulates the log
396+
probability, and returns the observed value.
397397
398-
This method is applied in the generated code for vectorized observed constants, e.g., `[1.0] .~
399-
MvNormal()`. Falls back to `dot_tilde(ctx, sampler, right, left, vi)`. Automatically
400-
accumulates the log-probability and returns only the observed value.
398+
Falls back to `dot_tilde(ctx, sampler, right, left, vi)`.
401399
"""
402400
function dot_tilde_observe(ctx, sampler, right, left, vi)
403401
logp = dot_tilde(ctx, sampler, right, left, vi)

0 commit comments

Comments
 (0)