1use thiserror::Error;
9
10pub type QuantResult<T> = Result<T, QuantError>;
12
13#[derive(Error, Debug)]
15pub enum QuantError {
16 #[error("Invalid block size: {0}")]
18 InvalidBlockSize(usize),
19
20 #[error("Invalid quantization type: {0}")]
22 InvalidQuantType(String),
23
24 #[error("Shape mismatch: expected {expected:?}, got {actual:?}")]
26 ShapeMismatch {
27 expected: Vec<usize>,
29 actual: Vec<usize>,
31 },
32
33 #[error("Data length mismatch: expected {expected}, got {actual}")]
35 DataLengthMismatch {
36 expected: usize,
38 actual: usize,
40 },
41
42 #[error("Calibration error: {0}")]
44 CalibrationError(String),
45
46 #[error("Numerical overflow during quantization")]
48 Overflow,
49
50 #[error("Invalid quantized data: {0}")]
52 InvalidData(String),
53
54 #[error("Tensor conversion error: {0}")]
56 TensorConversion(String),
57}