pub struct ObservationNormalizer { /* private fields */ }Expand description
Observation normalizer with running statistics.
Implementations§
Source§impl ObservationNormalizer
impl ObservationNormalizer
Sourcepub fn new(obs_dim: usize) -> Self
pub fn new(obs_dim: usize) -> Self
Create a normalizer for observations of dimension obs_dim.
Default: enabled, clip = 5.0, update_stats = true.
Sourcepub fn with_no_update(self) -> Self
pub fn with_no_update(self) -> Self
Disable statistics update (useful at evaluation time).
Sourcepub fn process(&mut self, batch: &[f32]) -> RlResult<Vec<f32>>
pub fn process(&mut self, batch: &[f32]) -> RlResult<Vec<f32>>
Process a batch of observations: optionally update stats, normalise, clip.
batch—[B × obs_dim]flat slice.
Returns a normalised [B × obs_dim] vector.
§Errors
RlError::DimensionMismatchifbatch.len() % obs_dim != 0.
Sourcepub fn stats(&self) -> &RunningStats
pub fn stats(&self) -> &RunningStats
Access the underlying running statistics.
Trait Implementations§
Source§impl Clone for ObservationNormalizer
impl Clone for ObservationNormalizer
Source§fn clone(&self) -> ObservationNormalizer
fn clone(&self) -> ObservationNormalizer
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 ObservationNormalizer
impl RefUnwindSafe for ObservationNormalizer
impl Send for ObservationNormalizer
impl Sync for ObservationNormalizer
impl Unpin for ObservationNormalizer
impl UnsafeUnpin for ObservationNormalizer
impl UnwindSafe for ObservationNormalizer
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