@@ -794,22 +794,23 @@ julia> # Now `a.x` will be sampled.
794794fixed (model:: Model ) = fixed (model. context)
795795
796796"""
797- (model::Model)([rng[ , varinfo] ])
797+ (model::Model)([rng, varinfo])
798798
799- Sample from the `model` using the `sampler` with random number generator `rng`
800- and the `context`, and store the sample and log joint probability in `varinfo`.
799+ Sample from the prior of the `model` with random number generator `rng`.
801800
802801Returns the model's return value.
803802
804- If no arguments are provided, uses the default random number generator and
805- samples from the prior.
803+ Note that calling this with an existing `varinfo` object will mutate it.
806804"""
805+ (model:: Model )() = model (Random. default_rng (), VarInfo ())
806+ function (model:: Model )(varinfo:: AbstractVarInfo )
807+ return model (Random. default_rng (), varinfo)
808+ end
809+ # ^ Weird Documenter.jl bug means that we have to write the two above separately
810+ # as it can only detect the `function`-less syntax.
807811function (model:: Model )(rng:: Random.AbstractRNG , varinfo:: AbstractVarInfo = VarInfo ())
808812 return first (sample!! (rng, model, varinfo))
809813end
810- function (model:: Model )(varinfo:: AbstractVarInfo = VarInfo ())
811- return model (Random. default_rng (), varinfo)
812- end
813814
814815"""
815816 use_threadsafe_eval(context::AbstractContext, varinfo::AbstractVarInfo)
@@ -853,10 +854,10 @@ end
853854
854855Evaluate the `model` with the given `varinfo`. If an extra context stack is
855856provided, the model's context is inserted into that context stack. See
856- [ `combine_model_and_external_contexts`](@ref) .
857+ `combine_model_and_external_contexts`.
857858
858859If multiple threads are available, the varinfo provided will be wrapped in a
859- [`DynamicPPL. ThreadSafeVarInfo`](@ref) before evaluation.
860+ ` ThreadSafeVarInfo` before evaluation.
860861
861862Returns a tuple of the model's return value, plus the updated `varinfo`
862863(unwrapped if necessary).
871872function AbstractPPL. evaluate!! (
872873 model:: Model , varinfo:: AbstractVarInfo , context:: AbstractContext
873874)
875+ Base. depwarn (
876+ " The `context` argument to evaluate!!(model, varinfo, context) is deprecated." ,
877+ :dynamicppl_evaluate_context ,
878+ )
874879 new_ctx = combine_model_and_external_contexts (model. context, context)
875880 model = contextualize (model, new_ctx)
876881 return evaluate!! (model, varinfo)
0 commit comments