@@ -44,11 +44,13 @@ const LDFCompatibleSampler = Union{Sampler{<:LDFCompatibleAlgorithm}}
44
44
kwargs...
45
45
)
46
46
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.
48
49
49
50
If a `DynamicPPL.Model` is passed as the `model` argument, it will be converted
50
51
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.
52
54
53
55
A `LogDensityFunction` contains both a model as well as a `VarInfo` object. In
54
56
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
57
59
to customise the type of VarInfo used during sampling, you can construct a
58
60
`LogDensityFunction` yourself and pass it to this method.
59
61
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
+
60
67
For a list of typical keyword arguments to `sample`, please see
61
68
https://turinglang.org/AbstractMCMC.jl/stable/api/#Common-keyword-arguments.
62
69
"""
0 commit comments