153
153
M<:DynamicPPL.Model,
154
154
F<:Function,
155
155
V<:DynamicPPL.AbstractVarInfo,
156
- C<:DynamicPPL.AbstractContext,
157
156
AD<:ADTypes.AbstractADType,
158
157
}
159
158
169
168
OptimLogDensity(model; adtype=adtype)
170
169
```
171
170
172
- Here, `ctx` must be a context that contains an `OptimizationContext` as its
173
- leaf.
174
-
175
171
If not specified, `adtype` defaults to `AutoForwardDiff()`.
176
172
177
173
An OptimLogDensity does not, in itself, obey the LogDensityProblems interface.
@@ -196,33 +192,26 @@ struct OptimLogDensity{
196
192
}
197
193
ldf:: DynamicPPL.LogDensityFunction{M,F,V,AD}
198
194
199
- # Inner constructors enforce that the model has an OptimizationContext as
200
- # its leaf context.
201
195
function OptimLogDensity (
202
196
model:: DynamicPPL.Model ,
203
197
getlogdensity:: Function ,
204
- vi:: DynamicPPL.VarInfo ,
205
- ctx:: OptimizationContext ;
198
+ vi:: DynamicPPL.VarInfo ;
206
199
adtype:: ADTypes.AbstractADType = Turing. DEFAULT_ADTYPE,
207
200
)
208
- new_context = DynamicPPL. setleafcontext (model, ctx)
209
- new_model = contextualize (model, new_context)
210
- return new {typeof(new_model),typeof(getlogdensity),typeof(vi),typeof(adtype)} (
211
- DynamicPPL. LogDensityFunction (new_model, getlogdensity, vi; adtype= adtype)
201
+ return new {typeof(model),typeof(getlogdensity),typeof(vi),typeof(adtype)} (
202
+ DynamicPPL. LogDensityFunction (model, getlogdensity, vi; adtype= adtype)
212
203
)
213
204
end
214
205
function OptimLogDensity (
215
206
model:: DynamicPPL.Model ,
216
- getlogdensity:: Function ,
217
- ctx:: OptimizationContext ;
207
+ getlogdensity:: Function ;
218
208
adtype:: ADTypes.AbstractADType = Turing. DEFAULT_ADTYPE,
219
209
)
220
210
# No varinfo
221
211
return OptimLogDensity (
222
212
model,
223
213
getlogdensity,
224
- DynamicPPL. ldf_default_varinfo (model, getlogdensity),
225
- ctx;
214
+ DynamicPPL. ldf_default_varinfo (model, getlogdensity);
226
215
adtype= adtype,
227
216
)
228
217
end
0 commit comments