1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! # quantize
//!
//! A tiny, readable quantization library — block-wise symmetric or asymmetric,
//! any bit width.
//!
//! ## Example
//!
//! ```
//! use quantize::quantize;
//!
//! let weights = [0.42_f32, -0.10, 0.70, -0.50];
//!
//! // 8-bit, block-size-32, f32 scales
//! let q = quantize::<f32, 8, 32>(&weights).unwrap();
//! let back = q.dequantize();
//!
//! assert!((back[0] - weights[0]).abs() < 0.01);
//! ```
//!
//! `BITS` and `BLOCK` are const generics, so `quantize::<f32, 4, 32>(...)`,
//! `quantize::<f32, 8, 64>(...)`, etc. all compile to specialized code.
//!
//! See `symmetric`, `asymmetric`, and `adaptive` for the other schemes.
//! To learn how the library got here, please see `chapters/`.
pub use ;
pub use ;
pub use Packed;
pub use Scale;
pub use Scheme;
pub use Quantized;
pub use ;
pub use ;
pub use decode;