Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove default_varinfo function #695

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions src/sampler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,6 @@ function AbstractMCMC.step(
return vi, nothing
end

function default_varinfo(rng::Random.AbstractRNG, model::Model, sampler::AbstractSampler)
return default_varinfo(rng, model, sampler, DefaultContext())
end
function default_varinfo(
rng::Random.AbstractRNG,
model::Model,
sampler::AbstractSampler,
context::AbstractContext,
)
init_sampler = initialsampler(sampler)
return VarInfo(rng, model, init_sampler, context)
end

function AbstractMCMC.sample(
rng::Random.AbstractRNG,
model::Model,
Expand All @@ -95,12 +82,15 @@ function AbstractMCMC.sample(
)
end

# initial step: general interface for resuming and
# This function handles the initial step in the AbstractMCMC interface for all
# samplers (except SampleFromUniform and SampleFromPrior). The subsequent steps
# are implemented individually for each sampler as they depend on the sampler
# state.
function AbstractMCMC.step(
rng::Random.AbstractRNG, model::Model, spl::Sampler; initial_params=nothing, kwargs...
)
# Sample initial values.
vi = default_varinfo(rng, model, spl)
vi = VarInfo(rng, model, initialsampler(spl), DefaultContext())

# Update the parameters if provided.
if initial_params !== nothing
Expand Down