Skip to content

Commit 3877cf0

Browse files
committed
Apply some basic tests
1 parent 88d132b commit 3877cf0

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

test/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
66
Bijectors = "76274a88-744f-5084-9051-94815aaf08c4"
77
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
88
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
9+
DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
910
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
1011
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
1112
DistributionsAD = "ced4e74d-a319-5a8a-b0ac-84af2272839c"

test/logdensityfunction.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ end
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
3648
end

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ using DynamicPPL
44
using AbstractMCMC
55
using AbstractPPL
66
using Bijectors
7+
using DifferentiationInterface
78
using Distributions
89
using DistributionsAD
910
using Documenter

0 commit comments

Comments
 (0)