Broadcasting — техника операций с матрицами и массивами, виртуально расширяющая один операнд так, чтобы его форма стала совместимой с другим операндом. Она позволяет выполнять операции, такие как добавление вектора к каждой строке или каждому столбцу матрицы, без физического копирования всех значений. Broadcasting распространен в библиотеках численных вычислений и машинного обучения.
Expanding the shape of an operand in a matrix math operation to dimensions compatible for that operation. For example, linear algebra requires that the two operands in a matrix addition operation must have the same dimensions. Consequently, you can't add a matrix of shape (m, n) to a vector of length n. Broadcasting enables this operation by virtually expanding the vector of length n to a matrix of shape (m, n) by replicating the same values down each column. Given the following definitions of A and B, linear algebra prohibits A+B because A and B have different dimensions: However, broadcasting enables the operation A+B by virtually expanding B to: Thus, A+B is now a valid operation: See the following description of broadcasting in NumPy for more details.