pub struct QuantParams {
pub scale: f32,
pub zero_point: i32,
pub bits: QuantBits,
pub scheme: QuantScheme,
pub per_channel_scales: Option<Vec<f32>>,
}Expand description
Quantization parameters computed from calibration.
Fields§
§scale: f32§zero_point: i32§bits: QuantBits§scheme: QuantScheme§per_channel_scales: Option<Vec<f32>>Per-channel scales (if per-channel quantization).
Implementations§
Source§impl QuantParams
impl QuantParams
Sourcepub fn from_range(
min_val: f32,
max_val: f32,
bits: QuantBits,
scheme: QuantScheme,
) -> Self
pub fn from_range( min_val: f32, max_val: f32, bits: QuantBits, scheme: QuantScheme, ) -> Self
Compute quantization parameters from data range.
Sourcepub fn calibrate(data: &[f32], bits: QuantBits, scheme: QuantScheme) -> Self
pub fn calibrate(data: &[f32], bits: QuantBits, scheme: QuantScheme) -> Self
Compute parameters from data using min/max calibration.
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 (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 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