Version: dev

prefetch_sample

Stable type · Prefetch and windows

Tier: stable · Kind: type · Topic: Prefetch and windows

PythonJuliaRust
SampleSampleSample

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.

Source

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]) (a NativeDataset); with windows, the Vector [sample_windows_at](B[k], windows); with transform, 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 for B[k]: the tick value from its refresh_times that B[k] snaps down to.
  • changed — whether anchor differs from this member’s anchor at the previous take! of the current order; always true on the first take! after start!. A caller copies only the changed samples into its forcing buffers.

Source

Rust

pub struct Sample<T> {
    pub data: Arc<T>,
    pub anchor: f64,
    pub changed: bool,
}

One member’s part of an epoch (spec/prefetch.md §3.4).

Source · Rust docs