#[non_exhaustive]pub enum CodecError {
UnsupportedBitWidth {
got: u8,
},
InvalidDimension {
got: u32,
},
DimensionMismatch {
expected: u32,
got: u32,
},
CodebookIncompatible {
expected: u8,
got: u8,
},
ConfigMismatch {
expected: Arc<str>,
got: Arc<str>,
},
CodebookEntryCount {
expected: u32,
got: u32,
bit_width: u8,
},
CodebookNotSorted,
CodebookDuplicate {
expected: u32,
got: u32,
},
InsufficientTrainingData {
expected: u32,
},
IndexOutOfRange {
index: u8,
bound: u32,
},
LengthMismatch {
left: usize,
right: usize,
},
InvalidResidualFlag {
got: u8,
},
}Expand description
Errors produced by the codec layer.
Maps 1:1 to tinyquant_cpu.codec._errors Python exceptions; see the
mapping table in docs/design/rust/error-model.md.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnsupportedBitWidth
bit_width is outside the supported set {2, 4, 8}.
InvalidDimension
dimension is zero — every codec operation requires a non-zero dim.
DimensionMismatch
Input vector length does not match the config’s declared dimension.
Fields
CodebookIncompatible
Codebook was trained under a different bit_width than the config.
Fields
ConfigMismatch
A CompressedVector carries a config_hash that differs from the
supplied CodecConfig.
Fields
CodebookEntryCount
Codebook entry count is inconsistent with bit_width.
Fields
CodebookNotSorted
Codebook entries are not sorted in non-decreasing order.
CodebookDuplicate
Codebook contains non-unique entries (violates np.unique invariant).
Fields
InsufficientTrainingData
Training data contains fewer distinct values than needed to fill the codebook.
IndexOutOfRange
A codebook index exceeds the codebook’s valid range [0, 2^bit_width).
LengthMismatch
An internal length invariant was violated (caller or internal bug).
InvalidResidualFlag
The residual flag byte in a serialized payload was not 0x00 or 0x01.
Trait Implementations§
Source§impl Clone for CodecError
impl Clone for CodecError
Source§fn clone(&self) -> CodecError
fn clone(&self) -> CodecError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CodecError
impl Debug for CodecError
Source§impl Display for CodecError
impl Display for CodecError
Source§impl Error for CodecError
impl Error for CodecError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()