burn_backend/quantization/parameters.rs
1use crate::Backend;
2
3pub use burn_std::quantization::{QParamTensor, QParams};
4
5/// The quantization parameters primitive.
6///
7/// # Remarks
8///
9/// This is a low-level struct used internally by the library to provide the quantization parameters
10/// to the backends. It is not designed for direct usage by users, and not recommended to import
11/// or use this struct directly.
12pub struct QuantizationParametersPrimitive<B: Backend> {
13 /// The scaling factor, one per block or a single one for a per-tensor level, in the quantized
14 /// tensor's float dtype.
15 pub scales: B::FloatTensorPrimitive,
16 /// The per-tensor scale that [`scales`](Self::scales) are expressed relative to, for a
17 /// two-level scheme. Always `f32`, unlike `scales`, so the two cannot go into a binary op
18 /// without a cast.
19 pub global: Option<B::FloatTensorPrimitive>,
20}