Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix depreciation for AutoReverseDiff. #638

Merged
merged 6 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading