Skip to content

Commit 01b5e41

Browse files
committed
remove FillArrays, LogDensityProblemsAD
The removal FillArrays will increase memory consumption for univariate slice samplers since we now maintain `d` copies of the univariate slice sampler object. However, since slice samplers are not expected to work for large `d`, this should be fine.
1 parent 6006993 commit 01b5e41

File tree

4 files changed

+2
-21
lines changed

4 files changed

+2
-21
lines changed

Project.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ version = "0.7.4"
66
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
77
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
88
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
9-
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
109
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1110
LogDensityProblems = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c"
12-
LogDensityProblemsAD = "996a588d-648d-4e1f-a8f0-a84b347e47b1"
1311
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1412
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1513

@@ -23,10 +21,8 @@ SliceSamplingTuringExt = ["Turing"]
2321
AbstractMCMC = "4, 5"
2422
Accessors = "0.1"
2523
Distributions = "0.25"
26-
FillArrays = "1"
2724
LinearAlgebra = "1"
2825
LogDensityProblems = "2"
29-
LogDensityProblemsAD = "1"
3026
Random = "1"
3127
Requires = "1"
3228
Turing = "0.37, 0.38"

ext/SliceSamplingTuringExt.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
module SliceSamplingTuringExt
33

44
if isdefined(Base, :get_extension)
5-
using LogDensityProblemsAD
65
using Random
76
using SliceSampling
87
using Turing
98
else
10-
using ..LogDensityProblemsAD
119
using ..Random
1210
using ..SliceSampling
1311
using ..Turing

src/SliceSampling.jl

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11

22
module SliceSampling
33

4-
using AbstractMCMC
54
using Accessors
5+
using AbstractMCMC
66
using Distributions
7-
using FillArrays
87
using LinearAlgebra
98
using LogDensityProblems
109
using Random
1110

12-
# The following is necessary because Turing wraps all models with
13-
# LogDensityProblemsAD by default. So we need access to these types.
14-
using LogDensityProblemsAD
15-
1611
# reexports
1712
using AbstractMCMC: sample, MCMCThreads, MCMCDistributed, MCMCSerial
1813
export sample, MCMCThreads, MCMCDistributed, MCMCSerial
@@ -59,14 +54,6 @@ function initial_sample(::Random.AbstractRNG, ::Any)
5954
)
6055
end
6156

62-
# If target is from `LogDensityProblemsAD`, unwrap target before calling `initial_sample`.
63-
# This is necessary since Turing wraps `DynamicPPL.Model`s when passed to an `externalsampler`.
64-
function initial_sample(
65-
rng::Random.AbstractRNG, wrap::LogDensityProblemsAD.ADGradientWrapper
66-
)
67-
return initial_sample(rng, parent(wrap))
68-
end
69-
7057
function exceeded_max_prop(max_prop::Int)
7158
return error(
7259
"Exceeded maximum number of proposal $(max_prop), ",

src/multivariate/randpermgibbs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function AbstractMCMC.step(
7373
unislices = if sampler.unislice isa AbstractVector
7474
sampler.unislice
7575
else
76-
Fill(sampler.unislice, d)
76+
fill(sampler.unislice, d)
7777
end
7878

7979
props = zeros(Int, d)

0 commit comments

Comments
 (0)