Struct QuantScheme
pub struct QuantScheme {
pub level: QuantLevel,
pub mode: QuantMode,
pub q_type: QuantInputType,
pub acc_precision: QuantAccPrecision,
pub propagation: QuantPropagation,
}
Expand description
Describes a quantization scheme/configuration.
Fields§
§level: QuantLevel
Granularity level of quantization (e.g., per-tensor).
mode: QuantMode
Quantization mode (e.g., symmetric).
q_type: QuantInputType
Data type used for storing quantized values (e.g., QInt8).
acc_precision: QuantAccPrecision
Precision used for accumulating intermediate values (e.g., during matmul).
propagation: QuantPropagation
Whether to propagate quantization to outputs or return unquantized results.
Implementations§
§
impl QuantScheme
impl QuantScheme
pub fn set_level(self, level: QuantLevel)
-> QuantScheme
pub fn set_level(self, level: QuantLevel) -> QuantScheme
Set the quantization level.
pub fn set_mode(self, mode: QuantMode) ->
QuantScheme
pub fn set_mode(self, mode: QuantMode) -> QuantScheme
Set the quantization mode.
pub fn set_q_type(self, q_type: QuantInputType)
-> QuantScheme
pub fn set_q_type(self, q_type: QuantInputType) -> QuantScheme
Set the data type used for quantized values.
pub fn set_acc_precision(self, acc_precision: QuantAccPrecision)
-> QuantScheme
pub fn set_acc_precision(self, acc_precision: QuantAccPrecision) -> QuantScheme
Set the accumulation precision used during computations.
pub fn set_propagation(self, propagation: QuantPropagation)
-> QuantScheme
pub fn set_propagation(self, propagation: QuantPropagation) -> QuantScheme
Set whether quantization is propagated through operations.
§
impl QuantScheme
impl QuantScheme
pub fn compute_range<B, const D: usize>(
&self,
tensor: &Tensor<B, D>,
calibration: &Calibration,
) -> CalibrationRange<B>
where
B: Backend,
pub fn compute_range<B, const D: usize>(
&self,
tensor: &Tensor<B, D>,
calibration: &Calibration,
) -> CalibrationRange<B>
where
B: Backend,
Compute the quantization range mapping.
pub fn compute_q_params<B>(
&self,
range: CalibrationRange<B>,
) -> QParams<Tensor<B, 1>, Tensor<B, 1, Int>>where
B: Backend,
pub fn compute_q_params<B>(
&self,
range: CalibrationRange<B>,
) -> QParams<Tensor<B, 1>, Tensor<B, 1, Int>>where
B: Backend,
Compute the quantization parameters.
Trait Implementations§
§
impl Clone for QuantScheme
impl Clone for QuantScheme
§
fn clone(&self) -> QuantScheme
fn clone(&self) -> QuantScheme
Returns a copy 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
more
§
impl Debug for QuantScheme
impl Debug for QuantScheme
§
impl Default for QuantScheme
impl Default for QuantScheme
§
fn default() -> QuantScheme
fn default() -> QuantScheme
Returns the “default value” for a type. Read
more
§
impl<'de> Deserialize<'de> for QuantScheme
impl<'de> Deserialize<'de> for QuantScheme
§
fn deserialize<__D>(
__deserializer: __D,
) -> Result<QuantScheme,
<__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<QuantScheme,
<__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§
impl Hash for QuantScheme
impl Hash for QuantScheme
§
impl Ord for QuantScheme
impl Ord for QuantScheme
§
fn cmp(&self, other: &QuantScheme)
-> Ordering
fn cmp(&self, other: &QuantScheme) -> Ordering
1.21.0 ·
Source§
fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read
more
§
impl PartialEq for QuantScheme
impl PartialEq for QuantScheme
§
impl PartialOrd for QuantScheme
impl PartialOrd for QuantScheme
§
impl Serialize for QuantScheme
impl Serialize for QuantScheme
§
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for QuantScheme
impl Eq for QuantScheme
impl StructuralPartialEq for QuantScheme
Auto Trait Implementations§
impl Freeze for QuantScheme
impl RefUnwindSafe for QuantScheme
impl Send for QuantScheme
impl Sync for QuantScheme
impl Unpin for QuantScheme
impl UnwindSafe for QuantScheme
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§
impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§
impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§
fn equivalent(&self, key: &K)
-> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if
they are equal.
§
impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§
fn equivalent(&self, key: &K)
-> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read
more
§
impl<T> Instrument for T
impl<T> Instrument for T
§
fn instrument(self, span: Span) ->
Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§
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
more
Source§
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
§
impl<T> Pointable for T
impl<T> Pointable for T
§
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§
impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§
fn read_from_little_endian(read: &mut
R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.