@@ -144,20 +144,22 @@ function AbstractMCMC.sample(
144
144
model:: AbstractModel ,
145
145
alg:: InferenceAlgorithm ,
146
146
N:: Integer ;
147
+ chain_type= Chains,
147
148
kwargs...
148
149
)
149
- return sample (rng, model, Sampler (alg, model), N; progress= PROGRESS[], kwargs... )
150
+ return sample (rng, model, Sampler (alg, model), N; progress= PROGRESS[], chain_type = chain_type, kwargs... )
150
151
end
151
152
152
153
function AbstractMCMC. sample (
153
154
model:: AbstractModel ,
154
155
alg:: InferenceAlgorithm ,
155
156
N:: Integer ;
156
157
resume_from= nothing ,
158
+ chain_type= Chains,
157
159
kwargs...
158
160
)
159
161
if resume_from === nothing
160
- return sample (model, Sampler (alg, model), N; progress= PROGRESS[], kwargs... )
162
+ return sample (model, Sampler (alg, model), N; progress= PROGRESS[], chain_type = chain_type, kwargs... )
161
163
else
162
164
return resume (resume_from, N)
163
165
end
@@ -169,9 +171,10 @@ function AbstractMCMC.psample(
169
171
alg:: InferenceAlgorithm ,
170
172
N:: Integer ,
171
173
n_chains:: Integer ;
174
+ chain_type= Chains,
172
175
kwargs...
173
176
)
174
- return psample (GLOBAL_RNG, model, alg, N, n_chains; progress= false , kwargs... )
177
+ return psample (GLOBAL_RNG, model, alg, N, n_chains; progress= false , chain_type = chain_type, kwargs... )
175
178
end
176
179
177
180
function AbstractMCMC. psample (
@@ -180,9 +183,10 @@ function AbstractMCMC.psample(
180
183
alg:: InferenceAlgorithm ,
181
184
N:: Integer ,
182
185
n_chains:: Integer ;
186
+ chain_type= Chains,
183
187
kwargs...
184
188
)
185
- return psample (rng, model, Sampler (alg, model), N, n_chains; progress= false , kwargs... )
189
+ return psample (rng, model, Sampler (alg, model), N, n_chains; progress= false , chain_type = chain_type, kwargs... )
186
190
end
187
191
188
192
function AbstractMCMC. sample_init! (
@@ -318,7 +322,8 @@ function AbstractMCMC.bundle_samples(
318
322
model:: AbstractModel ,
319
323
spl:: Sampler ,
320
324
N:: Integer ,
321
- ts:: Vector{<:AbstractTransition} ;
325
+ ts:: Vector{<:AbstractTransition} ,
326
+ ct:: Type{Chains} ;
322
327
discard_adapt:: Bool = true ,
323
328
save_state= true ,
324
329
kwargs...
@@ -375,7 +380,7 @@ function save(c::Chains, spl::AbstractSampler, model, vi, samples)
375
380
return setinfo (c, merge (nt, c. info))
376
381
end
377
382
378
- function resume (c:: Chains , n_iter:: Int ; kwargs... )
383
+ function resume (c:: Chains , n_iter:: Int ; chain_type = Chains, kwargs... )
379
384
@assert ! isempty (c. info) " [Turing] cannot resume from a chain without state info"
380
385
381
386
# Sample a new chain.
@@ -386,6 +391,7 @@ function resume(c::Chains, n_iter::Int; kwargs...)
386
391
n_iter;
387
392
resume_from= c,
388
393
reuse_spl_n= n_iter,
394
+ chain_type= chain_type,
389
395
kwargs...
390
396
)
391
397
0 commit comments