@@ -143,18 +143,18 @@ struct LogDensityFunction{
143
143
end
144
144
145
145
"""
146
- setadtype(f::LogDensityFunction, adtype::Union{Nothing,ADTypes.AbstractADType})
147
-
148
- Set the AD type used for evaluation of log density gradient in the given
149
- LogDensityFunction. This function also performs preparation of the gradient,
150
- and sets the `prep` field of the LogDensityFunction.
151
-
152
- If `adtype` is `nothing`, the `prep` field will be set to `nothing` as well.
146
+ LogDensityFunction(
147
+ ldf::LogDensityFunction,
148
+ adtype::Union{Nothing,ADTypes.AbstractADType}
149
+ )
153
150
154
- This function returns a new LogDensityFunction with the updated AD type, i.e. it does
155
- not mutate the input LogDensityFunction.
151
+ Create a new LogDensityFunction using the model, varinfo, and context from the given
152
+ `ldf` argument, but with the AD type set to `adtype`. To remove the AD type, pass
153
+ `nothing` as the second argument.
156
154
"""
157
- function setadtype (f:: LogDensityFunction , adtype:: Union{Nothing,ADTypes.AbstractADType} )
155
+ function LogDensityFunction (
156
+ f:: LogDensityFunction , adtype:: Union{Nothing,ADTypes.AbstractADType}
157
+ )
158
158
return if adtype === f. adtype
159
159
f # Avoid recomputing prep if not needed
160
160
else
0 commit comments