pub struct QuantizationAwareTraining { /* private fields */ }Expand description
Quantization-aware training (QAT) utilities.
Implementations§
Source§impl QuantizationAwareTraining
impl QuantizationAwareTraining
Sourcepub fn register_layer(&mut self, layer_name: String, config: QuantizationConfig)
pub fn register_layer(&mut self, layer_name: String, config: QuantizationConfig)
Registers a layer for quantization-aware training.
Sourcepub fn fake_quantize(
&self,
tensor: &Array2<f32>,
layer_name: &str,
) -> Array2<f32>
pub fn fake_quantize( &self, tensor: &Array2<f32>, layer_name: &str, ) -> Array2<f32>
Simulates quantization during forward pass (straight-through estimator).
This applies fake quantization: quantize then immediately dequantize, allowing gradients to flow through.
Sourcepub fn get_config(&self, layer_name: &str) -> Option<&QuantizationConfig>
pub fn get_config(&self, layer_name: &str) -> Option<&QuantizationConfig>
Gets the quantization config for a layer.
Sourcepub fn registered_layers(&self) -> Vec<&String>
pub fn registered_layers(&self) -> Vec<&String>
Returns all registered layer names.
Auto Trait Implementations§
impl Freeze for QuantizationAwareTraining
impl RefUnwindSafe for QuantizationAwareTraining
impl Send for QuantizationAwareTraining
impl Sync for QuantizationAwareTraining
impl Unpin for QuantizationAwareTraining
impl UnwindSafe for QuantizationAwareTraining
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> 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