@@ -11,15 +11,19 @@ import DifferentiationInterface as DI
11
11
A struct which contains a model, along with all the information necessary to:
12
12
13
13
- calculate its log density at a given point;
14
- - and if `adtype` is provided, calculate the gradient of the log density at that point.
14
+ - and if `adtype` is provided, calculate the gradient of the log density at
15
+ that point.
15
16
16
17
At its most basic level, a LogDensityFunction wraps the model together with its
17
18
the type of varinfo to be used, as well as the evaluation context. These must
18
- be known in order to calculate the log density (using [`DynamicPPL.evaluate!!`](@ref)).
19
-
20
- If the `adtype` keyword argument is provided, then this struct will also
21
- store the adtype along with other information for efficient calculation of the
22
- gradient of the log density.
19
+ be known in order to calculate the log density (using
20
+ [`DynamicPPL.evaluate!!`](@ref)).
21
+
22
+ If the `adtype` keyword argument is provided, then this struct will also store
23
+ the adtype along with other information for efficient calculation of the
24
+ gradient of the log density. Note that preparing a `LogDensityFunction` with an
25
+ AD type `AutoBackend()` requires the AD backend itself to have been loaded
26
+ (e.g. with `import Backend`).
23
27
24
28
`DynamicPPL.LogDensityFunction` implements the LogDensityProblems.jl interface.
25
29
If `adtype` is nothing, then only `logdensity` is implemented. If `adtype` is a
0 commit comments