pub struct QuantizationContext { /* private fields */ }Expand description
Quantization context for managing quantization state
Implementations§
Source§impl QuantizationContext
impl QuantizationContext
Sourcepub fn new(scheme: QuantizationScheme) -> Self
pub fn new(scheme: QuantizationScheme) -> Self
Create new quantization context
Sourcepub fn annotate_node(
&mut self,
node: NodeIndex,
annotation: QuantizationAnnotation,
)
pub fn annotate_node( &mut self, node: NodeIndex, annotation: QuantizationAnnotation, )
Add quantization annotation for a node
Sourcepub fn get_annotation(&self, node: NodeIndex) -> Option<&QuantizationAnnotation>
pub fn get_annotation(&self, node: NodeIndex) -> Option<&QuantizationAnnotation>
Get quantization annotation for a node
Sourcepub fn start_calibration(&mut self, node: NodeIndex)
pub fn start_calibration(&mut self, node: NodeIndex)
Start calibration for a node
Sourcepub fn update_calibration(
&mut self,
node: NodeIndex,
values: &[f32],
) -> TorshResult<()>
pub fn update_calibration( &mut self, node: NodeIndex, values: &[f32], ) -> TorshResult<()>
Update calibration data for a node
Sourcepub fn finalize_calibration(
&mut self,
node: NodeIndex,
) -> TorshResult<QuantizationParams>
pub fn finalize_calibration( &mut self, node: NodeIndex, ) -> TorshResult<QuantizationParams>
Finalize calibration and compute quantization parameters
Sourcepub fn prepare_qat(&mut self, graph: &mut FxGraph) -> TorshResult<()>
pub fn prepare_qat(&mut self, graph: &mut FxGraph) -> TorshResult<()>
Prepare graph for quantization-aware training (QAT)
Sourcepub fn quantize_graph(&self, graph: &mut FxGraph) -> TorshResult<()>
pub fn quantize_graph(&self, graph: &mut FxGraph) -> TorshResult<()>
Convert graph to quantized format
Auto Trait Implementations§
impl Freeze for QuantizationContext
impl RefUnwindSafe for QuantizationContext
impl Send for QuantizationContext
impl Sync for QuantizationContext
impl Unpin for QuantizationContext
impl UnsafeUnpin for QuantizationContext
impl UnwindSafe for QuantizationContext
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