Skip to content

Commit

Permalink
Fix AutoReverseDiff deprecation warning (#34)
Browse files Browse the repository at this point in the history
* Fix AutoReverseDiff deprecation warning

* Fix tests
  • Loading branch information
devmotion authored Aug 13, 2024
1 parent 449e566 commit b3c5801
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LogDensityProblemsAD"
uuid = "996a588d-648d-4e1f-a8f0-a84b347e47b1"
authors = ["Tamás K. Papp <[email protected]>"]
version = "1.9.0"
version = "1.9.1"

[deps]
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Expand Down Expand Up @@ -30,7 +30,7 @@ LogDensityProblemsADTrackerExt = "Tracker"
LogDensityProblemsADZygoteExt = "Zygote"

[compat]
ADTypes = "0.1.7, 0.2, 1"
ADTypes = "1.5"
DocStringExtensions = "0.8, 0.9"
Enzyme = "0.11, 0.12"
FiniteDifferences = "0.12"
Expand Down
4 changes: 2 additions & 2 deletions ext/LogDensityProblemsADADTypesExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ function LogDensityProblemsAD.ADgradient(ad::ADTypes.AutoForwardDiff{C}, ℓ) wh
end
end

function LogDensityProblemsAD.ADgradient(ad::ADTypes.AutoReverseDiff, ℓ)
return LogDensityProblemsAD.ADgradient(Val(:ReverseDiff), ℓ; compile = Val(ad.compile))
function LogDensityProblemsAD.ADgradient(ad::ADTypes.AutoReverseDiff{T}, ℓ) where {T}
return LogDensityProblemsAD.ADgradient(Val(:ReverseDiff), ℓ; compile = Val(T))
end

function LogDensityProblemsAD.ADgradient(::ADTypes.AutoTracker, ℓ)
Expand Down
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ADTypes # load support for AD types with options
import BenchmarkTools # load the heuristic chunks code
using ComponentArrays: ComponentVector # test with other vector types

struct EnzymeTestMode <: Enzyme.Mode{Enzyme.DefaultABI} end
struct EnzymeTestMode <: Enzyme.Mode{Enzyme.DefaultABI, false} end

####
#### test setup and utilities
Expand Down Expand Up @@ -81,7 +81,7 @@ ForwardDiff.checktag(::Type{ForwardDiff.Tag{TestTag, V}}, ::Base.Fix1{typeof(log

# ADTypes support
@test ADgradient(ADTypes.AutoReverseDiff(), ℓ) === ∇ℓ_default
@test ADgradient(ADTypes.AutoReverseDiff(; compile = false), ℓ) === ∇ℓ_nocompile
@test ADgradient(ADTypes.AutoReverseDiff(; compile = Val(false)), ℓ) === ∇ℓ_nocompile

∇ℓ_compile = ADgradient(:ReverseDiff, ℓ; compile=Val(true))
∇ℓ_compile_x = ADgradient(:ReverseDiff, ℓ; compile=Val(true), x=rand(3))
Expand All @@ -90,7 +90,7 @@ ForwardDiff.checktag(::Type{ForwardDiff.Tag{TestTag, V}}, ::Base.Fix1{typeof(log
end

# ADTypes support
@test typeof(ADgradient(ADTypes.AutoReverseDiff(; compile = true), ℓ)) === typeof(∇ℓ_compile)
@test typeof(ADgradient(ADTypes.AutoReverseDiff(; compile = Val(true)), ℓ)) === typeof(∇ℓ_compile)

for ∇ℓ in (∇ℓ_default, ∇ℓ_nocompile, ∇ℓ_compile, ∇ℓ_compile_x)
@test dimension(∇ℓ) == 3
Expand Down

2 comments on commit b3c5801

@devmotion
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/113032

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.9.1 -m "<description of version>" b3c5801b3dfedcc65f8cd235ff6f909d7a920b9e
git push origin v1.9.1

Please sign in to comment.