Dequantize INT8 back to FP32 (lossy reconstruction).
(&self, quantized: &[u8])
| 114 | |
| 115 | /// Dequantize INT8 back to FP32 (lossy reconstruction). |
| 116 | pub fn dequantize(&self, quantized: &[u8]) -> Vec<f32> { |
| 117 | debug_assert_eq!(quantized.len(), self.dim); |
| 118 | let mut out = Vec::with_capacity(self.dim); |
| 119 | for ((&q, &min), &scale) in quantized |
| 120 | .iter() |
| 121 | .zip(self.mins.iter()) |
| 122 | .zip(self.scales.iter()) |
| 123 | { |
| 124 | out.push(min + q as f32 * scale); |
| 125 | } |
| 126 | out |
| 127 | } |
| 128 | |
| 129 | /// Asymmetric L2 squared distance: query (FP32) vs candidate (INT8). |
| 130 | /// |