Skip to content

Commit 567e087

Browse files
committed
Fix more bugs
1 parent 74d3bdb commit 567e087

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/logdensityfunction.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ function LogDensityProblems.logdensity_and_gradient(
135135
f::LogDensityFunction, θ::AbstractVector, adtype::ADTypes.AbstractADType
136136
)
137137
# Ensure we concretise the elements of the params.
138-
# θ = map(identity, θ) # TODO: Is this needed?
138+
θ = map(identity, θ) # TODO: Is this needed?
139139
prep = DI.prepare_gradient(_flipped_logdensity, adtype, θ, DI.Constant(f))
140140
return DI.value_and_gradient(_flipped_logdensity, prep, adtype, θ, DI.Constant(f))
141141
end

test/ad.jl

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@testset "AD: ForwardDiff, ReverseDiff, and Mooncake" begin
22
@testset "$(m.f)" for m in DynamicPPL.TestUtils.DEMO_MODELS
3-
f = DynamicPPL.LogDensityFunction(m)
43
rand_param_values = DynamicPPL.TestUtils.rand_prior_true(m)
54
vns = DynamicPPL.TestUtils.varnames(m)
65
varinfos = DynamicPPL.TestUtils.setup_varinfos(m, rand_param_values, vns)
@@ -11,7 +10,7 @@
1110
# reference: https://github.com/TuringLang/DynamicPPL.jl/pull/571#issuecomment-1924304489
1211
θ = convert(Vector{Float64}, varinfo[:])
1312
# Calculate reference logp + gradient of logp using ForwardDiff
14-
default_adtype = ADTypes.AutoForwardDiff(; chunksize=0)
13+
default_adtype = ADTypes.AutoForwardDiff()
1514
ref_logp, ref_grad = LogDensityProblems.logdensity_and_gradient(
1615
f, θ, default_adtype
1716
)

0 commit comments

Comments
 (0)