use crate::Tensor;
use super::config::FakeQuantConfig;
use super::quantize::FakeQuantize;
pub fn fake_quantize(input: &Tensor, bits: usize, symmetric: bool) -> Tensor {
let config = if symmetric {
FakeQuantConfig::symmetric(bits)
} else {
FakeQuantConfig::asymmetric(bits)
};
let mut fq = FakeQuantize::new(config);
fq.forward_with_calibration(input)
}
pub fn ste_backward(grad_output: &Tensor) -> Tensor {
grad_output.clone()
}