liveBook · Manning

Affine transformation

As explained in Quantization and Fast Inference

An affine transformation is a mapping that combines a linear transformation with an additive offset.

The affine mapping r = S(q − Z) converts integer storage q into a real value r. Scale S sets the spacing between representable values; zero-point Z aligns real zero with an integer coordinate. section 2.6

The mapping has practical consequences for quantized representations:

  • Aligning the zero-point with real zero preserves ReLU sparsity and enables correct zero-padding. section 2.6
  • Values between grid points incur rounding error, bounded by S/2; values outside the grid are clipped and can incur unbounded distortion. section 2.6

How Quantization and Fast Inference covers it

How deep it goes
Defines r = S(q − Z), interprets scale and zero-point, and explains zero alignment without a numerical worked calculation.
Examples
Uses ReLU sparsity and zero-padding to show why the integer coordinate for real zero must be preserved.
What you can do after
Apply the mapping to represent floating-point tensors with integers using a scale and zero-point.
How it connects
Connects fixed-point arithmetic, scale, zero-point, symmetric and asymmetric quantization, and calibration.

Also explained in

Compare how 3 books explain affine transformation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quantization and Fast Inference. The section links point to the parts of the book it draws on.