pub struct PostTrainingQuantizer { /* private fields */ }
Expand description
Post-training quantization (PTQ) implementation
Implementations§
Source§impl PostTrainingQuantizer
impl PostTrainingQuantizer
Sourcepub fn new(config: QuantizationConfig) -> Self
pub fn new(config: QuantizationConfig) -> Self
Create new post-training quantizer
Sourcepub fn add_calibration_data(&mut self, name: &str, tensor: &ArrayD<f32>)
pub fn add_calibration_data(&mut self, name: &str, tensor: &ArrayD<f32>)
Add calibration data for a named tensor
Sourcepub fn finalize_calibration(
&mut self,
) -> Result<HashMap<String, QuantizationParams>>
pub fn finalize_calibration( &mut self, ) -> Result<HashMap<String, QuantizationParams>>
Finalize calibration and compute optimal quantization parameters
Sourcepub fn quantize_tensor(
&self,
tensor: &ArrayD<f32>,
params: &QuantizationParams,
) -> Result<QuantizedTensor>
pub fn quantize_tensor( &self, tensor: &ArrayD<f32>, params: &QuantizationParams, ) -> Result<QuantizedTensor>
Quantize a tensor using computed parameters
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PostTrainingQuantizer
impl RefUnwindSafe for PostTrainingQuantizer
impl Send for PostTrainingQuantizer
impl Sync for PostTrainingQuantizer
impl Unpin for PostTrainingQuantizer
impl UnwindSafe for PostTrainingQuantizer
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