@@ -60,8 +60,6 @@ struct ADResult{Tparams<:AbstractFloat,Tresult<:AbstractFloat}
6060 model:: Model
6161 " The VarInfo that was used"
6262 varinfo:: AbstractVarInfo
63- " The evaluation context that was used"
64- context:: AbstractContext
6563 " The values at which the model was evaluated"
6664 params:: Vector{Tparams}
6765 " The AD backend that was tested"
9290 grad_atol=1e-6,
9391 varinfo::AbstractVarInfo=link(VarInfo(model), model),
9492 params::Union{Nothing,Vector{<:AbstractFloat}}=nothing,
95- context::AbstractContext=DefaultContext(),
9693 reference_adtype::ADTypes.AbstractADType=REFERENCE_ADTYPE,
9794 expected_value_and_grad::Union{Nothing,Tuple{AbstractFloat,Vector{<:AbstractFloat}}}=nothing,
9895 verbose=true,
@@ -146,13 +143,7 @@ Everything else is optional, and can be categorised into several groups:
146143 prep_params)`. You could then evaluate the gradient at a different set of
147144 parameters using the `params` keyword argument.
148145
149- 3. _How to specify the evaluation context._
150-
151- A `DynamicPPL.AbstractContext` can be passed as the `context` keyword
152- argument to control the evaluation context. This defaults to
153- `DefaultContext()`.
154-
155- 4. _How to specify the results to compare against._ (Only if `test=true`.)
146+ 3. _How to specify the results to compare against._ (Only if `test=true`.)
156147
157148 Once logp and its gradient has been calculated with the specified `adtype`,
158149 it must be tested for correctness.
@@ -167,12 +158,12 @@ Everything else is optional, and can be categorised into several groups:
167158 The default reference backend is ForwardDiff. If none of these parameters are
168159 specified, ForwardDiff will be used to calculate the ground truth.
169160
170- 5 . _How to specify the tolerances._ (Only if `test=true`.)
161+ 4 . _How to specify the tolerances._ (Only if `test=true`.)
171162
172163 The tolerances for the value and gradient can be set using `value_atol` and
173164 `grad_atol`. These default to 1e-6.
174165
175- 6 . _Whether to output extra logging information._
166+ 5 . _Whether to output extra logging information._
176167
177168 By default, this function prints messages when it runs. To silence it, set
178169 `verbose=false`.
@@ -195,7 +186,6 @@ function run_ad(
195186 grad_atol:: AbstractFloat = 1e-6 ,
196187 varinfo:: AbstractVarInfo = link (VarInfo (model), model),
197188 params:: Union{Nothing,Vector{<:AbstractFloat}} = nothing ,
198- context:: AbstractContext = DefaultContext (),
199189 reference_adtype:: AbstractADType = REFERENCE_ADTYPE,
200190 expected_value_and_grad:: Union{Nothing,Tuple{AbstractFloat,Vector{<:AbstractFloat}}} = nothing ,
201191 verbose= true ,
@@ -207,7 +197,7 @@ function run_ad(
207197
208198 verbose && @info " Running AD on $(model. f) with $(adtype) \n "
209199 verbose && println (" params : $(params) " )
210- ldf = LogDensityFunction (model, varinfo, context ; adtype= adtype)
200+ ldf = LogDensityFunction (model, varinfo; adtype= adtype)
211201
212202 value, grad = logdensity_and_gradient (ldf, params)
213203 grad = collect (grad)
@@ -216,7 +206,7 @@ function run_ad(
216206 if test
217207 # Calculate ground truth to compare against
218208 value_true, grad_true = if expected_value_and_grad === nothing
219- ldf_reference = LogDensityFunction (model, varinfo, context ; adtype= reference_adtype)
209+ ldf_reference = LogDensityFunction (model, varinfo; adtype= reference_adtype)
220210 logdensity_and_gradient (ldf_reference, params)
221211 else
222212 expected_value_and_grad
@@ -245,7 +235,6 @@ function run_ad(
245235 return ADResult (
246236 model,
247237 varinfo,
248- context,
249238 params,
250239 adtype,
251240 value_atol,
0 commit comments