prefetch_sample
Stable type · Prefetch and windows
Tier: stable · Kind: type · Topic: Prefetch and windows
| Python | Julia | Rust |
|---|---|---|
Sample | Sample | Sample |
Python
class Sample(NamedTuple)
One member’s data for one epoch.
data is members[key].sample_at(B[k]) (with windows, the list
sample_windows_at(B[k], windows); with transform, transform(key, <that>)). It is read-only — the same object may be handed to several
epochs when the member’s anchor repeats, so its numpy arrays are marked
non-writeable; copy before mutating. anchor is the member’s cadence
anchor for B[k]. changed says whether anchor differs from this
member’s anchor at the previous take of the current order (always true
on the first take after start): copy only the changed samples into
the forcing buffers.
Julia
struct Sample
Sample(data::T, anchor::Float64, changed::Bool) where {T}
Sample{T}
One member’s sample for one epoch, as [take!](api:take!(::PrefetchGroup, ::Integer))
returns it inside an [EpochSample]:
data— the member’s [sample_at](B[k])(aNativeDataset); withwindows, theVector[sample_windows_at](B[k], windows); withtransform,transform(key, <that>). Read-only: the same object is handed to every epoch that shares the anchor, so a caller that mutates copies first.anchor— the member’s cadence anchor forB[k]: the tick value from itsrefresh_timesthatB[k]snaps down to.changed— whetheranchordiffers from this member’s anchor at the previoustake!of the current order; alwaystrueon the firsttake!afterstart!. A caller copies only the changed samples into its forcing buffers.