Skip to content

Commit f606a25

Browse files
committed
Implement Turing.Inference.getlogp_external
1 parent c3888ff commit f606a25

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "SliceSampling"
22
uuid = "43f4d3e8-9711-4a8c-bd1b-03ac73a255cf"
3-
version = "0.7.6"
3+
version = "0.7.7"
44

55
[deps]
66
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
@@ -21,7 +21,7 @@ Distributions = "0.25"
2121
LinearAlgebra = "1"
2222
LogDensityProblems = "2"
2323
Random = "1"
24-
Turing = "0.37, 0.38, 0.39"
24+
Turing = "0.39.5"
2525
julia = "1.10"
2626

2727
[extras]

ext/SliceSamplingTuringExt.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,19 @@ function Turing.Inference.getparams(
3939
)
4040
return state.transition.params
4141
end
42+
43+
function Turing.Inference.getlogp_external(
44+
::Turing.DynamicPPL.Model, t::SliceSampling.Transition, state
45+
)
46+
return t.lp
47+
end
4248
# end
4349

4450
function SliceSampling.initial_sample(rng::Random.AbstractRNG, ℓ::Turing.LogDensityFunction)
4551
model =.model
4652
vi = Turing.DynamicPPL.VarInfo(rng, model, Turing.SampleFromUniform())
4753
vi_spl = last(Turing.DynamicPPL.evaluate!!(model, rng, vi, Turing.SampleFromUniform()))
48-
θ = vi_spl[:]
54+
θ = vi_spl[:]
4955

5056
init_attempt_count = 1
5157
while !all(isfinite.(θ))

0 commit comments

Comments
 (0)