Skip to content

Commit 1b231a9

Browse files
formatting
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent f0af1d5 commit 1b231a9

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

ext/DynamicPPLMCMCChainsExt.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ julia> returned(model, chain)
101101
(-0.16489786710222099,)
102102
```
103103
"""
104-
function DynamicPPL.returned(
105-
model::DynamicPPL.Model, chain_full::MCMCChains.Chains
106-
)
104+
function DynamicPPL.returned(model::DynamicPPL.Model, chain_full::MCMCChains.Chains)
107105
chain = MCMCChains.get_sections(chain_full, :parameters)
108106
varinfo = DynamicPPL.VarInfo(model)
109107
iters = Iterators.product(1:size(chain, 1), 1:size(chain, 3))

src/context_implementations.jl

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,11 @@ Falls back to `tilde_observe!!(context, right, left, vi)` ignoring the informati
201201
and indices; if needed, these can be accessed through this function, though.
202202
"""
203203
function tilde_observe!!(context, right, left, vname, vi)
204-
is_rhs_model(right) && throw(ArgumentError("`~` with a model on the right-hand side of an observe statement is not supported"))
204+
is_rhs_model(right) && throw(
205+
ArgumentError(
206+
"`~` with a model on the right-hand side of an observe statement is not supported",
207+
),
208+
)
205209
return tilde_observe!!(context, right, left, vi)
206210
end
207211

@@ -215,7 +219,11 @@ By default, calls `tilde_observe(context, right, left, vi)` and accumulates the
215219
probability of `vi` with the returned value.
216220
"""
217221
function tilde_observe!!(context, right, left, vi)
218-
is_rhs_model(right) && throw(ArgumentError("`~` with a model on the right-hand side of an observe statement is not supported"))
222+
is_rhs_model(right) && throw(
223+
ArgumentError(
224+
"`~` with a model on the right-hand side of an observe statement is not supported",
225+
),
226+
)
219227
logp, vi = tilde_observe(context, right, left, vi)
220228
return left, acclogp_observe!!(context, vi, logp)
221229
end
@@ -682,7 +690,11 @@ Falls back to `dot_tilde_observe!!(context, right, left, vi)` ignoring the infor
682690
name and indices; if needed, these can be accessed through this function, though.
683691
"""
684692
function dot_tilde_observe!!(context, right, left, vn, vi)
685-
is_rhs_model(right) && throw(ArgumentError("`~` with a model on the right-hand side of an observe statement is not supported"))
693+
is_rhs_model(right) && throw(
694+
ArgumentError(
695+
"`~` with a model on the right-hand side of an observe statement is not supported",
696+
),
697+
)
686698
return dot_tilde_observe!!(context, right, left, vi)
687699
end
688700

@@ -695,7 +707,11 @@ probability, and return the observed value and updated `vi`.
695707
Falls back to `dot_tilde_observe(context, right, left, vi)`.
696708
"""
697709
function dot_tilde_observe!!(context, right, left, vi)
698-
is_rhs_model(right) && throw(ArgumentError("`~` with a model on the right-hand side of an observe statement is not supported"))
710+
is_rhs_model(right) && throw(
711+
ArgumentError(
712+
"`~` with a model on the right-hand side of an observe statement is not supported",
713+
),
714+
)
699715
logp, vi = dot_tilde_observe(context, right, left, vi)
700716
return left, acclogp_observe!!(context, vi, logp)
701717
end

src/model.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,6 @@ Return a wrapper around `model` indicating it is sampleable.
12661266
"""
12671267
function to_sampleable end
12681268

1269-
12701269
"""
12711270
ReturnedModelWrapper
12721271
@@ -1280,7 +1279,9 @@ end
12801279

12811280
is_rhs_model(::ReturnedModelWrapper) = true
12821281

1283-
function rand_like!!(model_wrap::ReturnedModelWrapper, context::AbstractContext, varinfo::AbstractVarInfo)
1282+
function rand_like!!(
1283+
model_wrap::ReturnedModelWrapper, context::AbstractContext, varinfo::AbstractVarInfo
1284+
)
12841285
# Return's the value and the (possibly mutated) varinfo.
12851286
return _evaluate!!(model_wrap.model, varinfo, context)
12861287
end

0 commit comments

Comments
 (0)