Matrix Multiplication
Combining an m×k matrix and a k×n matrix into an m×n matrix of row-column dot products.
- Composes linear transformations.
- Inner dimensions must match.
- O(mnk) naive; GPUs hit teraflops on this.
When to use: Every forward pass: linear layers, attention, embeddings, batched ops.
Example: A (3×2) · B (2×4) = AB (3×4). NumPy A @ B; PyTorch torch.matmul handles batched 3D/4D.