pub struct MixedPrecisionPolicy {
pub layer_bits: Vec<u32>,
pub layer_names: Vec<String>,
pub target_avg_bits: f32,
}Expand description
Per-layer bit-width assignment produced by the greedy sensitivity policy.
Fields§
§layer_bits: Vec<u32>Bit-width assigned to each layer (same order as the input sensitivity list).
layer_names: Vec<String>Layer names (mirrors the order of layer_bits).
target_avg_bits: f32Target average bits-per-parameter (budget constraint).
Implementations§
Source§impl MixedPrecisionPolicy
impl MixedPrecisionPolicy
Sourcepub fn from_sensitivity(
sensitivities: &[LayerSensitivity],
target_avg_bits: f32,
) -> QuantResult<Self>
pub fn from_sensitivity( sensitivities: &[LayerSensitivity], target_avg_bits: f32, ) -> QuantResult<Self>
Compute a mixed-precision policy from layer sensitivity profiles.
§Parameters
sensitivities— per-layerLayerSensitivityfromSensitivityAnalyzer.target_avg_bits— target average bit-width (e.g.,4.0for ~4-bit).
§Errors
QuantError::EmptyInput—sensitivitiesis empty.QuantError::InfeasibleCompressionTarget— target cannot be met even at max bits.
Sourcepub fn effective_average_bits(&self) -> f32
pub fn effective_average_bits(&self) -> f32
Effective average bits per parameter across all layers.
Sourcepub fn bits_for_layer(&self, name: &str) -> Option<u32>
pub fn bits_for_layer(&self, name: &str) -> Option<u32>
Return the bit-width assigned to a layer by name.
Returns None if the name is not found.
Trait Implementations§
Source§impl Clone for MixedPrecisionPolicy
impl Clone for MixedPrecisionPolicy
Source§fn clone(&self) -> MixedPrecisionPolicy
fn clone(&self) -> MixedPrecisionPolicy
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 moreAuto Trait Implementations§
impl Freeze for MixedPrecisionPolicy
impl RefUnwindSafe for MixedPrecisionPolicy
impl Send for MixedPrecisionPolicy
impl Sync for MixedPrecisionPolicy
impl Unpin for MixedPrecisionPolicy
impl UnsafeUnpin for MixedPrecisionPolicy
impl UnwindSafe for MixedPrecisionPolicy
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