TorchLean API

NN.Spec.Quantization

Tensor Quantization #

This module lifts FloatLib's RealAffineQuantizer pointwise over TorchLean's shape-indexed tensors. The real-domain specification retains arbitrary valid rounding rules. The rational tensor API imports FloatLib's executable affine quantizer directly.

Apply the affine quantizer independently at every coordinate of an arbitrary-rank tensor.

Instances For

    Reconstruct every code in an arbitrary-rank tensor on the quantizer's real grid.

    Instances For

      Pointwise condition saying that quantization does not clip any coordinate of x.

      Instances For

        Pointwise condition saying that every stored code belongs to the quantizer's code set.

        Instances For

          Every coordinate produced by tensor quantization lies in the declared code interval.

          Pointwise order is preserved by tensor quantization.

          An in-range code tensor survives pointwise dequantization and requantization exactly.

          If no coordinate clips, every tensor reconstruction error is at most half a step.