@@ -4,7 +4,7 @@ using ADTypes: AbstractADType, AutoForwardDiff
4
4
using Chairmarks: @be
5
5
import DifferentiationInterface as DI
6
6
using DocStringExtensions
7
- using DynamicPPL: Model, LogDensityFunction, VarInfo, AbstractVarInfo
7
+ using DynamicPPL: Model, LogDensityFunction, VarInfo, AbstractVarInfo, link
8
8
using LogDensityProblems: logdensity, logdensity_and_gradient
9
9
using Random: Random, Xoshiro
10
10
using Statistics: median
64
64
benchmark=false,
65
65
value_atol=1e-6,
66
66
grad_atol=1e-6,
67
- varinfo::AbstractVarInfo=VarInfo(model),
67
+ varinfo::AbstractVarInfo=link( VarInfo(model), model),
68
68
params::Vector{<:Real}=varinfo[:],
69
69
reference_adtype::ADTypes.AbstractADType=REFERENCE_ADTYPE,
70
70
expected_value_and_grad::Union{Nothing,Tuple{Real,Vector{<:Real}}}=nothing,
@@ -96,7 +96,10 @@ Everything else is optional, and can be categorised into several groups:
96
96
DynamicPPL contains several different types of VarInfo objects which change
97
97
the way model evaluation occurs. If you want to use a specific type of
98
98
VarInfo, pass it as the `varinfo` argument. Otherwise, it will default to
99
- using a `TypedVarInfo` generated from the model.
99
+ using a `TypedVarInfo` generated from the model. It will also perform
100
+ _linking_, that is, the parameters in the VarInfo will be transformed to
101
+ unconstrained Euclidean space if they aren't already in that space. Note
102
+ that the act of linking may change the length of the parameters.
100
103
101
104
2. _How to specify the parameters._
102
105
@@ -148,7 +151,7 @@ function run_ad(
148
151
benchmark= false ,
149
152
value_atol= 1e-6 ,
150
153
grad_atol= 1e-6 ,
151
- varinfo:: AbstractVarInfo = VarInfo (model),
154
+ varinfo:: AbstractVarInfo = link ( VarInfo (model), model),
152
155
params:: Vector{<:Real} = varinfo[:],
153
156
reference_adtype:: AbstractADType = REFERENCE_ADTYPE,
154
157
expected_value_and_grad:: Union{Nothing,Tuple{Real,Vector{<:Real}}} = nothing ,
0 commit comments