pub struct QuantizationParams {
pub tensor_type: GGUFTensorType,
pub block_size: usize,
pub bits_per_weight: f32,
pub has_scales: bool,
pub has_min: bool,
pub has_high_bits: bool,
pub block_size_bytes: usize,
}Expand description
Quantization parameters for different tensor types
Fields§
§tensor_type: GGUFTensorTypeThe tensor type this applies to
block_size: usizeBlock size (number of elements per quantization block)
bits_per_weight: f32Physical storage bits per weight, including block metadata overhead
has_scales: boolWhether this format supports scales
has_min: boolWhether this format supports minimum values
has_high_bits: boolWhether this format has high-bit extensions
block_size_bytes: usizeSize of each block in bytes
Implementations§
Source§impl QuantizationParams
impl QuantizationParams
Sourcepub fn for_type(tensor_type: TensorType) -> Self
pub fn for_type(tensor_type: TensorType) -> Self
Get quantization parameters for a tensor type
Sourcepub fn is_supported(&self) -> bool
pub fn is_supported(&self) -> bool
Whether GGUF readers and writers support this tensor type.
Sourcepub fn calculate_storage_size(&self, element_count: u64) -> Option<u64>
pub fn calculate_storage_size(&self, element_count: u64) -> Option<u64>
Calculate the storage size for a given number of elements.
Returns None for unsupported tensor types and on arithmetic overflow.
Sourcepub fn calculate_num_blocks(&self, element_count: u64) -> u64
pub fn calculate_num_blocks(&self, element_count: u64) -> u64
Calculate the number of blocks needed for a given element count
Trait Implementations§
Source§impl Clone for QuantizationParams
impl Clone for QuantizationParams
Source§impl Debug for QuantizationParams
impl Debug for QuantizationParams
Source§impl<'de> Deserialize<'de> for QuantizationParams
impl<'de> Deserialize<'de> for QuantizationParams
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for QuantizationParams
Available on crate feature std only.
impl Display for QuantizationParams
Available on crate feature
std only.Source§impl PartialEq for QuantizationParams
impl PartialEq for QuantizationParams
Source§impl Serialize for QuantizationParams
impl Serialize for QuantizationParams
impl StructuralPartialEq for QuantizationParams
Auto Trait Implementations§
impl Freeze for QuantizationParams
impl RefUnwindSafe for QuantizationParams
impl Send for QuantizationParams
impl Sync for QuantizationParams
impl Unpin for QuantizationParams
impl UnsafeUnpin for QuantizationParams
impl UnwindSafe for QuantizationParams
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more