From b365de7c308b1ec96755a083e3e293b7c12723da Mon Sep 17 00:00:00 2001 From: David Widmann Date: Thu, 9 Mar 2023 14:12:00 +0100 Subject: [PATCH] Fix compatibility with LogDensityProblemsAD 1.4 (#1965) --- Project.toml | 4 ++-- src/essential/ad.jl | 8 ++++---- test/Project.toml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Project.toml b/Project.toml index 22fd78e66..920e35d76 100644 --- a/Project.toml +++ b/Project.toml @@ -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" @@ -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" diff --git a/src/essential/ad.jl b/src/essential/ad.jl index 410ef0d26..3000f46c9 100644 --- a/src/essential/ad.jl +++ b/src/essential/ad.jl @@ -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) diff --git a/test/Project.toml b/test/Project.toml index 89dccc6be..179f90b52 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -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"