pub struct SampledBatch {
pub observations: Vec<f32>,
pub next_observations: Vec<f32>,
pub actions: Vec<f32>,
pub rewards: Vec<f32>,
pub terminated: Vec<bool>,
pub truncated: Vec<bool>,
pub obs_dim: usize,
pub act_dim: usize,
pub batch_size: usize,
pub extra: Vec<(String, Vec<f32>)>,
}Expand description
A sampled batch of transitions. Owns its data (copied from the ring buffer).
Fields§
§observations: Vec<f32>§next_observations: Vec<f32>§actions: Vec<f32>§rewards: Vec<f32>§terminated: Vec<bool>§truncated: Vec<bool>§obs_dim: usize§act_dim: usize§batch_size: usize§extra: Vec<(String, Vec<f32>)>Extra column data, populated only when columns are registered.
Each entry is (column_name, flat_data) where flat_data has
length batch_size * column_dim.
Implementations§
Source§impl SampledBatch
impl SampledBatch
pub fn with_capacity(batch_size: usize, obs_dim: usize, act_dim: usize) -> Self
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clear all data but retain allocated capacity for reuse.
Note: extra is cleared entirely (the outer Vec). If you alternate
between buffers with different extra-column schemas, the inner Vecs’
capacity is lost. This is acceptable because cross-buffer reuse of
extra columns is uncommon.
Trait Implementations§
Source§impl Clone for SampledBatch
impl Clone for SampledBatch
Source§fn clone(&self) -> SampledBatch
fn clone(&self) -> SampledBatch
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SampledBatch
impl RefUnwindSafe for SampledBatch
impl Send for SampledBatch
impl Sync for SampledBatch
impl Unpin for SampledBatch
impl UnwindSafe for SampledBatch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more