juniorNumPy
What is broadcasting in NumPy?
Updated May 17, 2026
Short answer
Broadcasting allows operations on arrays of different shapes.
Deep explanation
NumPy automatically expands smaller arrays to match larger ones without copying data, enabling efficient vectorized operations.
Real-world example
Adding bias terms in neural networks.
Common mistakes
- Expecting broadcasting to always work without shape compatibility.
Follow-up questions
- What are broadcasting rules?
- Is broadcasting memory efficient?