Multiplying an (m by n) matrix by an (n by p) matrix gives an (m by p) matrix; the inner dimensions must match, and each output entry is a dot product of a row and a column.
It is associative and distributive but not commutative: AB is generally not BA, and one order may not even be defined.
Cost is about m x n x p operations, which is why neural networks batch inputs into matrices and run on GPUs.
Transpose rule: (AB) transposed = B transposed times A transposed. Checking shapes is the quickest way to catch bugs in code.
Loading…