pub struct QuantizationParams {
pub scale: f32,
pub zero_point: i32,
}Expand description
Parameters describing how floating-point values were quantized to integers.
Supports both per-tensor (single scale/zero_point) and per-channel quantization (vectors of scales/zero_points).
Fields§
§scale: f32§zero_point: i32Implementations§
Source§impl QuantizationParams
impl QuantizationParams
Sourcepub fn from_range(min: f32, max: f32) -> Self
pub fn from_range(min: f32, max: f32) -> Self
Compute quantization parameters from observed min/max values.
Uses asymmetric affine quantization: scale = (max - min) / 255 zero_point = round(-min / scale)
Trait Implementations§
Source§impl Clone for QuantizationParams
impl Clone for QuantizationParams
Source§fn clone(&self) -> QuantizationParams
fn clone(&self) -> QuantizationParams
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 QuantizationParams
impl RefUnwindSafe for QuantizationParams
impl Send for QuantizationParams
impl Sync for QuantizationParams
impl Unpin for QuantizationParams
impl UnsafeUnpin for QuantizationParams
impl UnwindSafe for QuantizationParams
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