pub fn quantize_tensor(
tensor: &Tensor<f32>,
quant_type: QuantType,
) -> QuantResult<QuantizedTensor>Expand description
Quantizes a tensor to the specified quantization type.
§Arguments
tensor- The input tensor to quantizequant_type- The target quantization type
§Returns
A quantized tensor
§Example
ⓘ
use axonml_quant::{quantize_tensor, QuantType};
let tensor = Tensor::from_vec(vec![1.0, 2.0, 3.0, 4.0], &[4])?;
let quantized = quantize_tensor(&tensor, QuantType::Q8_0)?;