Affine transformation
An affine transformation is a mapping of the form x ↦ Ax + b, where A is a linear map and b is a fixed offset.
Geometry for Programmers
An affine transformation is a geometric mapping that preserves straight lines and parallelism while allowing translation, rotation, scaling, and shearing.
- How it is used
- Maps geometry between positions and coordinate bases, including efficient triangle normalization for point containment.
- How deep it goes
- Derives six coefficients from three 2D point pairs and implements point mapping, then extends representation to homogeneous matrices.
- Examples
- Uses three moved 2D points, affine-transformation figures, and an arbitrary triangle mapped to a standard basis.
- What you can do after
- Apply it via SymPy or matrix multiplication to fit 2D transforms and preprocess triangles for containment checks.
Read how Geometry for Programmers explains affine transformation →
CUDA for LLMs
An affine transformation combines a linear transformation with an additive offset.
- How it is used
- Applies learned element-wise scaling and shifting after LayerNorm standardizes a feature vector.
- How deep it goes
- Defines the element-wise scale-and-shift formula and its place after standardization, without deriving the transformation further.
- Examples
- Uses a kernel expression that multiplies normalized values by weights and adds bias.
- What you can do after
- Apply learned element-wise scaling and shifting to standardized features in LayerNorm.
Quantization and Fast Inference
An affine transformation is a mapping that combines a linear transformation with an additive offset.
- How it is used
- Maps floating-point tensors to integer storage for quantized computation.
- 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.
Read how Quantization and Fast Inference explains affine transformation →
Also covered in
Related concepts
- linear layerimplemented by · A linear layer is a neural-network layer that applies a learned affine transformation to its input, typically using weights and a bias.
- layer normalizationpart of · Layer normalization standardizes neural-network activations across specified feature dimensions independently for each example, often using learned scale and bias parameters.
- linear regressionused by · Linear regression is a statistical method that models a numeric response as a linear function of one or more predictor variables with fitted parameters.
- quantizationused by · Model quantization represents model parameters or computations with reduced-precision numerical values, often to lower storage or computational requirements.
- geometric transformationkind of · A geometric transformation is a mapping or operation that changes or expresses the position, orientation, scale, shape, or coordinate representation of geometric objects.
Questions about affine transformation
What is affine transformation?
An affine transformation is a mapping of the form x ↦ Ax + b, where A is a linear map and b is a fixed offset.
Which Manning books explain affine transformation?
Geometry for Programmers, CUDA for LLMs and Quantization and Fast Inference.
What is affine transformation a kind of?
Affine transformation is a kind of geometric transformation. A geometric transformation is a mapping or operation that changes or expresses the position, orientation, scale, shape, or coordinate representation of geometric objects.
What is affine transformation part of?
Affine transformation is part of layer normalization. Layer normalization standardizes neural-network activations across specified feature dimensions independently for each example, often using learned scale and bias parameters.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


