Skip to main content

Observer

Trait Observer 

Source
pub trait Observer {
    // Required methods
    fn observe(&mut self, data: &[f32]);
    fn compute_params(&self) -> QuantResult<(f32, i32)>;
    fn reset(&mut self);
    fn is_calibrated(&self) -> bool;
}
Expand description

Common interface for all quantization observers.

Required Methods§

Source

fn observe(&mut self, data: &[f32])

Observe a batch of values.

Source

fn compute_params(&self) -> QuantResult<(f32, i32)>

Compute (scale, zero_point) from accumulated statistics.

§Errors

Returns QuantError::CalibrationRequired if no data has been observed.

Source

fn reset(&mut self)

Reset all accumulated statistics.

Source

fn is_calibrated(&self) -> bool

Whether any data has been observed.

Implementors§