File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed
Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
66Bijectors = " 76274a88-744f-5084-9051-94815aaf08c4"
77Combinatorics = " 861a8166-3701-5b0c-9a16-15d98fcdc6aa"
88Compat = " 34da2185-b29b-5c13-b0c7-acf172513d20"
9+ DifferentiationInterface = " a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
910Distributed = " 8ba89e20-285c-5b6f-9357-94700520ee1b"
1011Distributions = " 31c24e10-a181-5473-b8eb-7969acd0382f"
1112DistributionsAD = " ced4e74d-a319-5a8a-b0ac-84af2272839c"
Original file line number Diff line number Diff line change 3131 θ = varinfo[:]
3232 @test LogDensityProblems. logdensity (logdensity, θ) ≈ logjoint (model, varinfo)
3333 @test LogDensityProblems. dimension (logdensity) == length (θ)
34+
35+ # Test a single backend on the generic
36+ # ADgradient(::AbstractADType, ::LogDensityFunction) method. This really just
37+ # checks that it runs at all.
38+ if varinfo isa DynamicPPL. TypedVarInfo
39+ ad = ADTypes. AutoMooncake (; config= nothing )
40+ ∇ℓ = LogDensityProblemsAD. ADgradient (ad, logdensity)
41+ @test isa (
42+ LogDensityProblems. logdensity_and_gradient (∇ℓ, θ),
43+ Tuple{Float64, Vector{Float64}},
44+ )
45+ end
3446 end
3547 end
3648end
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ using DynamicPPL
44using AbstractMCMC
55using AbstractPPL
66using Bijectors
7+ using DifferentiationInterface
78using Distributions
89using DistributionsAD
910using Documenter
You can’t perform that action at this time.
0 commit comments