axonml_quant/lib.rs
1//! Axonml Quant - Model Quantization Library
2//!
3//! # File
4//! `crates/axonml-quant/src/lib.rs`
5//!
6//! # Author
7//! Andrew Jewell Sr - AutomataNexus
8//!
9//! # Updated
10//! March 8, 2026
11//!
12//! # Disclaimer
13//! Use at own risk. This software is provided "as is", without warranty of any
14//! kind, express or implied. The author and AutomataNexus shall not be held
15//! liable for any damages arising from the use of this software.
16
17#![warn(missing_docs)]
18#![warn(clippy::all)]
19#![allow(clippy::module_name_repetitions)]
20#![allow(clippy::must_use_candidate)]
21#![allow(clippy::missing_errors_doc)]
22
23pub mod calibration;
24pub mod dequantize;
25pub mod error;
26pub mod inference;
27pub mod quantize;
28pub mod types;
29
30pub use calibration::{CalibrationData, calibrate};
31pub use dequantize::{dequantize_block, dequantize_tensor};
32pub use error::{QuantError, QuantResult};
33pub use inference::{QuantizedLinear, QuantizedModel, deserialize_quantized, serialize_quantized};
34pub use quantize::{quantize_model, quantize_tensor};
35pub use types::{QuantType, QuantizedBlock, QuantizedTensor};
36
37// =============================================================================
38// Constants
39// =============================================================================
40
41/// Default block size for quantization.
42pub const DEFAULT_BLOCK_SIZE: usize = 32;
43
44/// Maximum block size supported.
45pub const MAX_BLOCK_SIZE: usize = 256;
46
47// =============================================================================
48// Tests
49// =============================================================================
50
51#[cfg(test)]
52mod tests {
53 use super::*;
54
55 #[test]
56 fn test_constants() {
57 assert!(DEFAULT_BLOCK_SIZE > 0);
58 assert!(MAX_BLOCK_SIZE >= DEFAULT_BLOCK_SIZE);
59 }
60}