diff --git a/src/varinfo.jl b/src/varinfo.jl index 11fe08d0f..1dbd4cc9f 100644 --- a/src/varinfo.jl +++ b/src/varinfo.jl @@ -1694,6 +1694,10 @@ Return the current value(s) of the random variables sampled by `spl` in `vi`. The value(s) may or may not be transformed to Euclidean space. """ +function getindex(vi::UntypedVarInfo, spl::Sampler) + indices = _getranges(vi, spl) + return copy(vi.metadata.vals[indices]) +end getindex(vi::VarInfo, spl::Sampler) = copy(getindex_internal(vi, _getranges(vi, spl))) function getindex(vi::TypedVarInfo, spl::Sampler) # Gets the ranges as a NamedTuple