Skip to content

fix ms sampler #61

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

Merged
merged 1 commit into from
Sep 20, 2023
Merged
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
6 changes: 3 additions & 3 deletions src/samplers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ end
#####MultiStepSampler

"""
MultiStepSampler{names}(batchsize, stacksize, n, rng)
MultiStepSampler{names}(batchsize, n, stacksize, rng)

Sampler that fetches steps `[x, x+1, ..., x + n -1]` for each trace of each sampled index
`x`. The samples are returned in an array of batchsize elements. For each element, n is
Expand All @@ -312,12 +312,12 @@ the same.
struct MultiStepSampler{names, S <: Union{Nothing,Int}, R <: AbstractRNG}
n::Int
batchsize::Int
stacksize::Int
stacksize::S
rng::R
end

MultiStepSampler(t::AbstractTraces; kw...) = MultiStepSampler{keys(t)}(; kw...)
function MultiStepSampler{names}(; n, batchsize=32, stacksize=nothing, rng=Random.default_rng()) where {names}
function MultiStepSampler{names}(; n::Int, batchsize, stacksize=nothing, rng=Random.default_rng()) where {names}
@assert n >= 1 "n must be ≥ 1."
ss = stacksize == 1 ? nothing : stacksize
MultiStepSampler{names, typeof(ss), typeof(rng)}(n, batchsize, ss, rng)
Expand Down