pub struct SensitivityAnalyzer;Expand description
Analyses per-layer quantization sensitivity.
Implementations§
Source§impl SensitivityAnalyzer
impl SensitivityAnalyzer
Sourcepub fn analyze_layer(
&self,
weights: &[f32],
bits_range: &[u32],
name: impl Into<String>,
) -> QuantResult<LayerSensitivity>
pub fn analyze_layer( &self, weights: &[f32], bits_range: &[u32], name: impl Into<String>, ) -> QuantResult<LayerSensitivity>
Compute quantization sensitivity for one layer across bits_range.
§Parameters
weights— flat weight tensor (any layout).bits_range— candidate bit-widths (e.g.,&[2, 3, 4, 8]).name— optional layer label.
§Errors
QuantError::EmptyInput—weightsis empty.QuantError::InvalidBitWidth— any bit-width inbits_rangeis 0 or > 16.
Sourcepub fn analyze_multiple<'a>(
&self,
layers: &[(&'a str, &'a [f32])],
bits_range: &[u32],
) -> QuantResult<Vec<LayerSensitivity>>
pub fn analyze_multiple<'a>( &self, layers: &[(&'a str, &'a [f32])], bits_range: &[u32], ) -> QuantResult<Vec<LayerSensitivity>>
Analyse multiple layers and return their sensitivity profiles.
§Parameters
layers— list of(name, weights)pairs.bits_range— candidate bit-widths to test for each layer.
§Errors
Propagates errors from analyze_layer.
Trait Implementations§
Source§impl Clone for SensitivityAnalyzer
impl Clone for SensitivityAnalyzer
Source§fn clone(&self) -> SensitivityAnalyzer
fn clone(&self) -> SensitivityAnalyzer
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 SensitivityAnalyzer
impl Debug for SensitivityAnalyzer
Source§impl Default for SensitivityAnalyzer
impl Default for SensitivityAnalyzer
Source§fn default() -> SensitivityAnalyzer
fn default() -> SensitivityAnalyzer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SensitivityAnalyzer
impl RefUnwindSafe for SensitivityAnalyzer
impl Send for SensitivityAnalyzer
impl Sync for SensitivityAnalyzer
impl Unpin for SensitivityAnalyzer
impl UnsafeUnpin for SensitivityAnalyzer
impl UnwindSafe for SensitivityAnalyzer
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