Intermediate · Data
Broadcasting
Visual diagram · (in preparation) · Math · (in preparation) · Worked example · 3 difficulty levels.
TL;DR. An operation that expands operand shapes to match for arithmetic operations between arrays of different sizes.
Technical Definition
An operation that expands operand shapes to match for arithmetic operations between arrays of different sizes.
How it works
Broadcasting is a mechanism in libraries like NumPy that allows operations on arrays of different shapes and sizes. It handles this by implicitly expanding the smaller array to match the larger one's shape, enabling element-wise computations that would otherwise be disallowed.