MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / dequantize

Method dequantize

nodedb-vector/src/quantize/sq8.rs:116–127  ·  view source on GitHub ↗

Dequantize INT8 back to FP32 (lossy reconstruction).

(&self, quantized: &[u8])

Source from the content-addressed store, hash-verified

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 ///

Callers 2

Calls 2

iterMethod · 0.45
pushMethod · 0.45

Tested by 1