Skip to content

Commit d02826d

Browse files
committed
feat(quantized): add dequantize_i8_to_f32
https://claude.ai/code/session_01SbYsmmbPf9YQuYbHZN52Zh
1 parent eb27a23 commit d02826d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/hpc/quantized.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ pub fn quantize_f32_to_i8(data: &[f32]) -> (Vec<i8>, QuantParams) {
229229
(quantized, QuantParams { scale, zero_point: 0, min_val, max_val })
230230
}
231231

232+
/// Dequantize i8 to f32.
233+
pub fn dequantize_i8_to_f32(data: &[i8], params: &QuantParams, len: usize) -> Vec<f32> {
234+
data.iter().take(len).map(|&q| q as f32 * params.scale).collect()
235+
}
236+
232237
/// Per-channel i8 quantization (per row).
233238
pub fn quantize_per_channel_i8(
234239
data: &[f32],

0 commit comments

Comments
 (0)