Read this lesson as text

Broadcasting in NumPy

Linear Algebra for Machine Learning · Axiom Academy

How shapes align for element-wise operations Arrays are aligned from the RIGHT. When comparing dimensions: (1) equal sizes are fine, (2) one size = 1 can broadcast to any size, (3) missing dimensions are treated as 1. Can you add an array of shape (3, 4) with an array of shape (4,)? What is the result shape of broadcasting (2, 1, 5) + (3, 5)?

This is the written version of the interactive lesson above. See the full Linear Algebra for Machine Learning course.