Broadcasting in NumPy

Understanding one of the key concepts of NumPy, PyTorch and TensorFlow

Lev Maximov
Towards Data Science
4 min readJan 2, 2021

--

Image credit: Author

Broadcasting is an operation of matching the dimensions of differently shaped arrays in order to be able to perform further operations on those arrays (eg per-element arithmetic).

A very powerful feature, but the documentation in somewhat insufficient. Usually people learn about it…

--

--