You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: HISTORY.md
+18-1
Original file line number
Diff line number
Diff line change
@@ -128,6 +128,22 @@ This release removes the feature of `VarInfo` where it kept track of which varia
128
128
129
129
**Other changes**
130
130
131
+
### Models now store AD backend types
132
+
133
+
In `DynamicPPL.Model`, an extra field `adtype::Union{Nothing,ADTypes.AbstractADType}` has been added. This field is used to store the AD backend which should be used when calculating gradients of the log density.
134
+
135
+
The field can be set by passing an extra argument to the `Model` constructor, but more realistically, it is likely that users will want to manually set the `adtype` field on an existing model:
As far as `DynamicPPL.Model` is concerned, this field does not actually have any effect.
144
+
However, when a `LogDensityFunction` is constructed from said model, it will inherit the `adtype` field from the model.
145
+
See below for more information on `LogDensityFunction`.
146
+
131
147
### `LogDensityProblems` interface
132
148
133
149
LogDensityProblemsAD is now removed as a dependency.
@@ -136,7 +152,8 @@ Instead of constructing a `LogDensityProblemAD.ADgradient` object, we now direct
136
152
Note that if you wish, you can still construct an `ADgradient` out of a `LogDensityFunction` object (there is nothing preventing this).
137
153
138
154
However, in this version, `LogDensityFunction` now takes an extra AD type argument.
139
-
If this argument is not provided, the behaviour is exactly the same as before, i.e. you can calculate `logdensity` but not its gradient.
155
+
By default, this AD type is inherited from the model that the `LogDensityFunction` is constructed from.
156
+
If the model does not have an AD type, or if the argument is explicitly set to `nothing`, the behaviour is exactly the same as before, i.e. you can calculate `logdensity` but not its gradient.
140
157
However, if you do pass an AD type, that will allow you to calculate the gradient as well.
141
158
You may thus find that it is easier to instead do this:
0 commit comments