Skip to content

Commit 17a1f00

Browse files
committed
Improve docstring
1 parent 4606bdd commit 17a1f00

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/mcmc/abstractmcmc.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@ const LDFCompatibleSampler = Union{Sampler{<:LDFCompatibleAlgorithm}}
4444
kwargs...
4545
)
4646
47-
Perform MCMC sampling on the given `model` or `ldf` using the specified `alg`, for `N` iterations.
47+
Perform MCMC sampling on the given `model` or `ldf` using the specified `alg`,
48+
for `N` iterations.
4849
4950
If a `DynamicPPL.Model` is passed as the `model` argument, it will be converted
5051
into a `DynamicPPL.LogDensityFunction` internally, which is then used for
51-
sampling.
52+
sampling. If necessary, the AD backend used for sampling will be inferred from
53+
the sampler.
5254
5355
A `LogDensityFunction` contains both a model as well as a `VarInfo` object. In
5456
the case where a `DynamicPPL.Model` is passed, the associated `varinfo` is
@@ -57,6 +59,11 @@ created using the `initialise_varinfo` function; by default, this generates a
5759
to customise the type of VarInfo used during sampling, you can construct a
5860
`LogDensityFunction` yourself and pass it to this method.
5961
62+
If you are passing an `ldf::LogDensityFunction` to a gradient-based sampler,
63+
`ldf.adtype` must be set to an `AbstractADType` (using the constructor
64+
`LogDensityFunction(model, varinfo; adtype=adtype)`). Any `adtype` information
65+
in the sampler will be ignored, in favour of the one in the `ldf`.
66+
6067
For a list of typical keyword arguments to `sample`, please see
6168
https://turinglang.org/AbstractMCMC.jl/stable/api/#Common-keyword-arguments.
6269
"""

0 commit comments

Comments
 (0)