Skip to content

Commit

Permalink
Fix depreciation for AutoReverseDiff. (#638)
Browse files Browse the repository at this point in the history
* Update DynamicPPLReverseDiffExt.jl

* Update Project.toml

* Update ext/DynamicPPLReverseDiffExt.jl

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update DynamicPPLReverseDiffExt.jl

* Update Project.toml

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
yebai and github-actions[bot] authored Aug 10, 2024
1 parent 949d153 commit 3b8dcea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ DynamicPPLReverseDiffExt = ["ReverseDiff"]
DynamicPPLZygoteRulesExt = ["ZygoteRules"]

[compat]
ADTypes = "0.2, 1"
ADTypes = "1"
AbstractMCMC = "5"
AbstractPPL = "0.8.4"
Accessors = "0.1"
Expand Down
6 changes: 3 additions & 3 deletions ext/DynamicPPLReverseDiffExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ else
end

function LogDensityProblemsAD.ADgradient(
ad::ADTypes.AutoReverseDiff, ℓ::DynamicPPL.LogDensityFunction
)
ad::ADTypes.AutoReverseDiff{Tcompile}, ℓ::DynamicPPL.LogDensityFunction
) where {Tcompile}
return LogDensityProblemsAD.ADgradient(
Val(:ReverseDiff),
ℓ;
compile=Val(ad.compile),
compile=Val(Tcompile),
# `getparams` can return `Vector{Real}`, in which case, `ReverseDiff` will initialize the gradients to Integer 0
# because at https://github.com/JuliaDiff/ReverseDiff.jl/blob/c982cde5494fc166965a9d04691f390d9e3073fd/src/tracked.jl#L473
# `zero(D)` will return 0 when D is Real.
Expand Down

0 comments on commit 3b8dcea

Please sign in to comment.