burn_tensor/tensor/quantization/primitive.rs
1use cubecl_quant::scheme::QuantScheme;
2
3use crate::quantization::{QuantAcc, QuantPropagation};
4
5/// Quantized tensor primitive.
6pub trait QTensorPrimitive {
7 /// Returns the quantization settings for the given tensor.
8 fn scheme(&self) -> &QuantScheme;
9 /// The precision used for the accumulation in various kernels.
10 fn acc_precision(&self) -> QuantAcc {
11 QuantAcc::F32
12 }
13 /// How quantization is propagated during computation.
14 fn propagation(&self) -> QuantPropagation {
15 QuantPropagation::Inhibit
16 }
17
18 /// Returns the default tensor quantization scheme.
19 fn default_scheme() -> QuantScheme {
20 QuantScheme::default()
21 }
22}