burn_backend/tensor/quantization/
parameters.rs

1use crate::Backend;
2use alloc::vec::Vec;
3use burn_std::{DType, Shape};
4
5pub use burn_std::quantization::QParams;
6
7/// The quantization parameters primitive.
8///
9/// # Remarks
10///
11/// This is a low-level struct used internally by the library to provide the quantization parameters
12/// to the backends. It is not designed for direct usage by users, and not recommended to import
13/// or use this struct directly.
14pub struct QuantizationParametersPrimitive<B: Backend> {
15    /// The scaling factor.
16    pub scales: B::FloatTensorPrimitive,
17}
18
19/// A quantization parameter tensor descriptor.
20#[derive(Debug, Clone, PartialEq, Eq)]
21pub struct QParamTensor {
22    /// Start of the tensor in the buffer
23    pub offset_start: usize,
24    /// Offset of tensor end from the end of the buffer
25    pub offset_end: usize,
26    /// Shape of the tensor
27    pub shape: Shape,
28    /// Strides of the tensor
29    pub strides: Vec<usize>,
30    /// Data type of the tensor
31    pub dtype: DType,
32}