pub struct ActivationQuantizer { /* private fields */ }Expand description
Activation quantization manager
Implementations§
Source§impl ActivationQuantizer
impl ActivationQuantizer
Sourcepub fn new(config: ActivationQuantConfig) -> Self
pub fn new(config: ActivationQuantConfig) -> Self
Create new activation quantizer
Sourcepub fn start_calibration(&mut self)
pub fn start_calibration(&mut self)
Start calibration phase
Sourcepub fn end_calibration(&mut self)
pub fn end_calibration(&mut self)
End calibration phase
Sourcepub fn is_calibration_complete(&self) -> bool
pub fn is_calibration_complete(&self) -> bool
Check if calibration is complete
Sourcepub fn quantize_activation(
&mut self,
tensor: &Tensor,
layer_name: &str,
training: bool,
) -> Result<Tensor>
pub fn quantize_activation( &mut self, tensor: &Tensor, layer_name: &str, training: bool, ) -> Result<Tensor>
Quantize activation tensor for a specific layer
Sourcepub fn get_layer_stats(&self, layer_name: &str) -> Option<&ActivationStats>
pub fn get_layer_stats(&self, layer_name: &str) -> Option<&ActivationStats>
Get statistics for a specific layer
Sourcepub fn get_all_stats(&self) -> &HashMap<String, ActivationStats>
pub fn get_all_stats(&self) -> &HashMap<String, ActivationStats>
Get all layer statistics
Sourcepub fn save_calibration(&self, path: &str) -> Result<()>
pub fn save_calibration(&self, path: &str) -> Result<()>
Save calibration statistics to file
Sourcepub fn load_calibration(&mut self, path: &str) -> Result<()>
pub fn load_calibration(&mut self, path: &str) -> Result<()>
Load calibration statistics from file
Sourcepub fn configure_layer(&mut self, layer_name: &str, config: LayerQuantConfig)
pub fn configure_layer(&mut self, layer_name: &str, config: LayerQuantConfig)
Configure quantization for a specific layer
Sourcepub fn disable_layer(&mut self, layer_name: &str)
pub fn disable_layer(&mut self, layer_name: &str)
Disable quantization for a specific layer
Sourcepub fn get_memory_savings(&self) -> f32
pub fn get_memory_savings(&self) -> f32
Get memory savings from activation quantization
Auto Trait Implementations§
impl Freeze for ActivationQuantizer
impl RefUnwindSafe for ActivationQuantizer
impl Send for ActivationQuantizer
impl Sync for ActivationQuantizer
impl Unpin for ActivationQuantizer
impl UnsafeUnpin for ActivationQuantizer
impl UnwindSafe for ActivationQuantizer
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more