Skip to content
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d70e1be
added sampling context and unwrap_childcontext
torfjelde May 31, 2021
f743990
updated tilde methods
torfjelde May 31, 2021
3d2e7e2
updated model call signature
torfjelde May 31, 2021
4f1d396
updated compiler
torfjelde May 31, 2021
b187d74
formatting
torfjelde May 31, 2021
ee99f8c
added getsym for vectors
torfjelde May 31, 2021
c4845d0
Update src/varname.jl
torfjelde May 31, 2021
a0c05f3
fixed some signatures for Model
torfjelde May 31, 2021
307cd7e
fixed a method call
torfjelde May 31, 2021
5972771
fixed method signatures
torfjelde Jun 1, 2021
c4ecd0e
sort of fixed the matchingvalue functionality for model
torfjelde Jun 1, 2021
a34b51c
formatting
torfjelde Jun 1, 2021
6368282
Merge branch 'tor/tilde-simplification' into tor/sampler-context
torfjelde Jun 1, 2021
e4a2cf8
removed left-over acclogp! that should not be here anymore
torfjelde Jun 1, 2021
7605785
export SamplingContext
torfjelde Jun 1, 2021
354ac52
use context instead of ctx to refer to contexts
torfjelde Jun 1, 2021
b7a2b3b
formatting
torfjelde Jun 1, 2021
9e0fc9a
use context instead of ctx for variables
torfjelde Jun 1, 2021
7a4a1a3
use context instead of ctx to refer to contexts
torfjelde Jun 1, 2021
7899473
Update src/compiler.jl
torfjelde Jun 2, 2021
1630476
Update src/context_implementations.jl
torfjelde Jun 2, 2021
6892d2b
Apply suggestions from code review
torfjelde Jun 2, 2021
fec00b6
Merge branch 'master' into tor/sampler-context
torfjelde Jun 3, 2021
ffb4933
Merge branch 'master' into tor/sampler-context
torfjelde Jun 4, 2021
f52550f
introduce EvaluationContext and make PriorContext and LikelihoodConte…
torfjelde Jun 4, 2021
800ee2d
Merge branch 'tor/tilde-simplification' into tor/sampler-context
torfjelde Jun 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,8 @@ function build_output(modelinfo, linenumbernode)
# Add the internal arguments to the user-specified arguments (positional + keywords).
evaluatordef[:args] = vcat(
[
:(__rng__::$(Random.AbstractRNG)),
:(__model__::$(DynamicPPL.Model)),
:(__varinfo__::$(DynamicPPL.AbstractVarInfo)),
:(__sampler__::$(DynamicPPL.AbstractSampler)),
:(__context__::$(DynamicPPL.AbstractContext)),
],
modelinfo[:allargs_exprs],
Expand All @@ -407,7 +405,15 @@ function build_output(modelinfo, linenumbernode)
evaluatordef[:kwargs] = []

# Replace the user-provided function body with the version created by DynamicPPL.
evaluatordef[:body] = modelinfo[:body]
evaluatordef[:body] = quote
# in case someone accessed these
if __context__ isa $(DynamicPPL.SamplingContext)
__rng__ = __context__.rng
__sampler__ = __context__.sampler
end

$(modelinfo[:body])
end

## Build the model function.

Expand Down
Loading