pub struct QuantParams {
pub scale: f32,
pub zero_point: i8,
pub anti_resonance: f32,
pub bits: u8,
}Expand description
Quantization parameters for a tensor or channel
Fields§
§scale: f32Scale factor (float = quant * scale + zero_point)
zero_point: i8Zero point offset (for asymmetric quantization)
anti_resonance: f32Anti-resonance offset from π
bits: u8Quantization bits (7 for signed int8)
Implementations§
Source§impl QuantParams
impl QuantParams
Sourcepub fn symmetric(min_val: f32, max_val: f32) -> Self
pub fn symmetric(min_val: f32, max_val: f32) -> Self
Create symmetric quantization params (for weights)
Uses π-based anti-resonance to avoid boundary collapse.
Sourcepub fn asymmetric(min_val: f32, max_val: f32) -> Self
pub fn asymmetric(min_val: f32, max_val: f32) -> Self
Create asymmetric quantization params (for activations)
Maps [min_val, max_val] to [-128, 127] with π-based calibration.
Sourcepub fn dequantize(&self, quantized: i8) -> f32
pub fn dequantize(&self, quantized: i8) -> f32
Dequantize a single i8 value to f32
Trait Implementations§
Source§impl Clone for QuantParams
impl Clone for QuantParams
Source§fn clone(&self) -> QuantParams
fn clone(&self) -> QuantParams
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 QuantParams
impl Debug for QuantParams
Source§impl Default for QuantParams
impl Default for QuantParams
impl Copy for QuantParams
Auto Trait Implementations§
impl Freeze for QuantParams
impl RefUnwindSafe for QuantParams
impl Send for QuantParams
impl Sync for QuantParams
impl Unpin for QuantParams
impl UnsafeUnpin for QuantParams
impl UnwindSafe for QuantParams
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