Learn Before
Example

Tensor Broadcasting Example

When applying the broadcasting mechanism to add a 3×13\times1 matrix a and a 1×21\times2 matrix b, a deep learning framework cannot perform a direct elementwise addition because their shapes do not match. Instead, broadcasting resolves this by producing a larger 3×23\times2 matrix: it replicates matrix a along its columns and matrix b along its rows. Once both matrices are expanded to the identical 3×23\times2 shape, their elements are successfully added together.

0

1

Updated 2026-05-01

Contributors are:

Who are from:

Tags

D2L

Dive into Deep Learning @ D2L