pub struct MovingAvgObserver {
pub min_val: f32,
pub max_val: f32,
pub momentum: f32,
pub bits: u32,
pub symmetric: bool,
/* private fields */
}Expand description
Tracks an exponential moving average of per-batch min/max statistics.
Update rule:
min_val ← momentum × min_val + (1 − momentum) × batch_min
max_val ← momentum × max_val + (1 − momentum) × batch_maxFields§
§min_val: f32Running EMA minimum.
max_val: f32Running EMA maximum.
momentum: f32EMA momentum (fraction of old statistics to retain, typically 0.9–0.99).
bits: u32Quantization bit-width.
symmetric: boolSymmetric vs asymmetric quantization.
Implementations§
Trait Implementations§
Source§impl Clone for MovingAvgObserver
impl Clone for MovingAvgObserver
Source§fn clone(&self) -> MovingAvgObserver
fn clone(&self) -> MovingAvgObserver
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 moreSource§impl Debug for MovingAvgObserver
impl Debug for MovingAvgObserver
Source§impl Observer for MovingAvgObserver
impl Observer for MovingAvgObserver
Source§fn compute_params(&self) -> QuantResult<(f32, i32)>
fn compute_params(&self) -> QuantResult<(f32, i32)>
Compute
(scale, zero_point) from accumulated statistics. Read moreSource§fn is_calibrated(&self) -> bool
fn is_calibrated(&self) -> bool
Whether any data has been observed.
Auto Trait Implementations§
impl Freeze for MovingAvgObserver
impl RefUnwindSafe for MovingAvgObserver
impl Send for MovingAvgObserver
impl Sync for MovingAvgObserver
impl Unpin for MovingAvgObserver
impl UnsafeUnpin for MovingAvgObserver
impl UnwindSafe for MovingAvgObserver
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