Trait burn::tensor::quantization::Quantization

pub trait Quantization<E, Q>
where E: Float, Q: PrimInt,
{ // Required methods fn new(alpha: E, beta: E) -> Self; fn quantize(&self, values: &[E]) -> Vec<Q>; fn dequantize(&self, values: &[Q]) -> Vec<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§

fn new(alpha: E, beta: E) -> Self

Create a new quantization scheme for an input range [alpha, beta].

fn quantize(&self, values: &[E]) -> Vec<Q>

Convert the values to a lower precision data type.

fn dequantize(&self, values: &[Q]) -> Vec<E>

Convert the values back to a higher precision data type.

Object Safety§

This trait is not object safe.

Implementors§

§

impl<E, Q> Quantization<E, Q> for SymmetricQuantization<E, Q>
where E: Float, Q: PrimInt,

§

impl<E, Q, A> Quantization<E, Q> for AffineQuantization<E, Q, A>
where E: Float, Q: PrimInt, A: PrimInt,