pub struct SymmetricQuantization<E: Float + Send + Sync> {
pub scale: E,
/* private fields */
}Expand description
Symmetric quantization scheme.
Fields§
§scale: EThe scaling factor.
Implementations§
Source§impl<E: Float + Send + Sync> SymmetricQuantization<E>
impl<E: Float + Send + Sync> SymmetricQuantization<E>
Sourcepub fn init(scale: E, value: QuantValue) -> Self
pub fn init(scale: E, value: QuantValue) -> Self
Initialize a symmetric quantization scheme with the given parameters.
Trait Implementations§
Source§impl<E: Clone + Float + Send + Sync> Clone for SymmetricQuantization<E>
impl<E: Clone + Float + Send + Sync> Clone for SymmetricQuantization<E>
Source§fn clone(&self) -> SymmetricQuantization<E>
fn clone(&self) -> SymmetricQuantization<E>
Returns a duplicate 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 moreSource§impl<'de, E> Deserialize<'de> for SymmetricQuantization<E>
impl<'de, E> Deserialize<'de> for SymmetricQuantization<E>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<E: Float + Send + Sync> Quantization<E> for SymmetricQuantization<E>
impl<E: Float + Send + Sync> Quantization<E> for SymmetricQuantization<E>
Source§fn quantize<Q: PrimInt>(&self, values: &[E]) -> Vec<Q>
fn quantize<Q: PrimInt>(&self, values: &[E]) -> Vec<Q>
Convert the values to a lower precision data type.
Source§fn dequantize<Q: PrimInt>(&self, values: &[Q]) -> Vec<E>
fn dequantize<Q: PrimInt>(&self, values: &[Q]) -> Vec<E>
Convert the values back to a higher precision data type.
Source§fn quantize_one<Q: PrimInt>(&self, value: E) -> Q
fn quantize_one<Q: PrimInt>(&self, value: E) -> Q
Convert a single value to a lower precision data type.
Source§fn dequantize_one<Q: PrimInt>(&self, value: Q) -> E
fn dequantize_one<Q: PrimInt>(&self, value: Q) -> E
Convert a single value back to a higher precision data type.
Source§impl<E> Serialize for SymmetricQuantization<E>
impl<E> Serialize for SymmetricQuantization<E>
impl<E: Copy + Float + Send + Sync> Copy for SymmetricQuantization<E>
impl<E: Float + Send + Sync> Eq for SymmetricQuantization<E>
Auto Trait Implementations§
impl<E> Freeze for SymmetricQuantization<E>where
E: Freeze,
impl<E> RefUnwindSafe for SymmetricQuantization<E>where
E: RefUnwindSafe,
impl<E> Send for SymmetricQuantization<E>
impl<E> Sync for SymmetricQuantization<E>
impl<E> Unpin for SymmetricQuantization<E>where
E: Unpin,
impl<E> UnwindSafe for SymmetricQuantization<E>where
E: UnwindSafe,
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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