pub trait Quantization<E: Float + Send + Sync, Q: PrimInt + Send + Sync> {
// Required methods
fn range() -> (Q, Q);
fn new(alpha: E, beta: E) -> Self;
fn quantize(&self, values: &[E]) -> Vec<Q>;
fn quantize_one(&self, value: E) -> Q;
fn dequantize(&self, values: &[Q]) -> Vec<E>;
fn dequantize_one(&self, value: Q) -> E;
}
Expand description
Quantization scheme to convert elements of a higher precision data type E
to a lower precision
data type Q
and vice-versa.
Required Methods§
Sourcefn new(alpha: E, beta: E) -> Self
fn new(alpha: E, beta: E) -> Self
Create a new quantization scheme for an input range [alpha, beta]
.
Sourcefn quantize_one(&self, value: E) -> Q
fn quantize_one(&self, value: E) -> Q
Convert a single value to a lower precision data type.
Sourcefn dequantize(&self, values: &[Q]) -> Vec<E>
fn dequantize(&self, values: &[Q]) -> Vec<E>
Convert the values back to a higher precision data type.
Sourcefn dequantize_one(&self, value: Q) -> E
fn dequantize_one(&self, value: Q) -> E
Convert a single value back to a higher precision data type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.