Skip to content

Commit

Permalink
Fix compatibility with LogDensityProblemsAD 1.4 (#1965)
Browse files Browse the repository at this point in the history
  • Loading branch information
devmotion authored Mar 9, 2023
1 parent 35a1280 commit b365de7
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,6 +1,6 @@
name = "Turing"
uuid = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
version = "0.24.1"
version = "0.24.2"

[deps]
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
Expand Down Expand Up @@ -52,7 +52,7 @@ EllipticalSliceSampling = "0.5, 1"
ForwardDiff = "0.10.3"
Libtask = "0.7, 0.8"
LogDensityProblems = "2"
LogDensityProblemsAD = "1"
LogDensityProblemsAD = "1.4"
MCMCChains = "5, 6"
NamedArrays = "0.9"
Reexport = "0.2, 1"
Expand Down
8 changes: 4 additions & 4 deletions src/essential/ad.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ function LogDensityProblemsAD.ADgradient(ad::ForwardDiffAD, ℓ::Turing.LogDensi
ForwardDiff.Tag(f, eltype(θ))
end
chunk_size = getchunksize(ad)
config = if chunk_size == 0
ForwardDiff.GradientConfig(f, θ, ForwardDiff.Chunk), tag)
chunk = if chunk_size == 0
ForwardDiff.Chunk(θ)
else
ForwardDiff.GradientConfig(f, θ, ForwardDiff.Chunk(length(θ), chunk_size), tag)
ForwardDiff.Chunk(length(θ), chunk_size)
end

return LogDensityProblemsAD.ADgradient(Val(:ForwardDiff), ℓ; gradientconfig=config)
return LogDensityProblemsAD.ADgradient(Val(:ForwardDiff), ℓ; chunk, tag, x = θ)
end

function LogDensityProblemsAD.ADgradient(::TrackerAD, ℓ::Turing.LogDensityFunction)
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ DynamicPPL = "0.21.5"
FiniteDifferences = "0.10.8, 0.11, 0.12"
ForwardDiff = "0.10.12 - 0.10.32, 0.10"
LogDensityProblems = "2"
LogDensityProblemsAD = "1.2"
LogDensityProblemsAD = "1.4"
MCMCChains = "5, 6"
NamedArrays = "0.9.4"
Optim = "0.22, 1.0"
Expand Down

2 comments on commit b365de7

@devmotion
Copy link
Member 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/79251

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 v0.24.2 -m "<description of version>" b365de7c308b1ec96755a083e3e293b7c12723da
git push origin v0.24.2

Please sign in to comment.