pub struct ExperienceTable { /* private fields */ }Expand description
Append-only columnar table for RL transitions.
All data is stored in flat Vec<f32> arrays for efficient export
to numpy. The table only appends, never reallocating existing data
in-place.
Implementations§
Source§impl ExperienceTable
impl ExperienceTable
Sourcepub fn new(obs_dim: usize, act_dim: usize) -> Self
pub fn new(obs_dim: usize, act_dim: usize) -> Self
Create a new table with the given observation and action dimensions.
Sourcepub fn push_slices(
&mut self,
obs: &[f32],
next_obs: &[f32],
action: &[f32],
reward: f32,
terminated: bool,
truncated: bool,
) -> Result<(), RloxError>
pub fn push_slices( &mut self, obs: &[f32], next_obs: &[f32], action: &[f32], reward: f32, terminated: bool, truncated: bool, ) -> Result<(), RloxError>
Append a transition from borrowed slices, avoiding intermediate allocation.
Sourcepub fn push(&mut self, record: ExperienceRecord) -> Result<(), RloxError>
pub fn push(&mut self, record: ExperienceRecord) -> Result<(), RloxError>
Append a single transition. Returns error on dimension mismatch.
Sourcepub fn observations_raw(&self) -> &[f32]
pub fn observations_raw(&self) -> &[f32]
Raw slice of all observation data. Shape: [count * obs_dim].
Sourcepub fn actions_raw(&self) -> &[f32]
pub fn actions_raw(&self) -> &[f32]
Raw slice of all action data. Shape: [count * act_dim].
Sourcepub fn rewards_raw(&self) -> &[f32]
pub fn rewards_raw(&self) -> &[f32]
Raw slice of all rewards.
Sourcepub fn terminated(&self) -> &[bool]
pub fn terminated(&self) -> &[bool]
Slice of terminated flags.
Auto Trait Implementations§
impl Freeze for ExperienceTable
impl RefUnwindSafe for ExperienceTable
impl Send for ExperienceTable
impl Sync for ExperienceTable
impl Unpin for ExperienceTable
impl UnwindSafe for ExperienceTable
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> 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