Skip to main content

quantize_ste

Function quantize_ste 

Source
pub fn quantize_ste(
    activations: &Tensor,
    config: &BitNetConfig,
) -> Result<Tensor>
Expand description

Apply quantization in a differentiable way using Straight-Through Estimator.

During forward pass: quantize -> dequantize During backward pass: gradients flow through unchanged

§Arguments

  • activations - Input tensor
  • config - BitNet configuration

§Errors

Returns error if quantization fails.