burn_tensor/tensor/quantization/
calibration.rsuse crate::{backend::Backend, Tensor};
#[derive(Clone, Debug)]
pub struct CalibrationRange<B: Backend> {
pub min: Tensor<B, 1>,
pub max: Tensor<B, 1>,
}
pub trait Calibration {
fn compute_range<B: Backend, const D: usize>(
&self,
tensor: &Tensor<B, D>,
) -> CalibrationRange<B>;
}
pub struct MinMaxCalibration {}
impl Calibration for MinMaxCalibration {
fn compute_range<B: Backend, const D: usize>(
&self,
tensor: &Tensor<B, D>,
) -> CalibrationRange<B> {
let min = tensor.clone().min();
let max = tensor.clone().max();
CalibrationRange { min, max }
}
}