easy framework

Broadcasting Addition

Add a 1D bias vector to each row of a 2D matrix using broadcasting.

Input:

  • x: A 2D tensor of shape (m, n)
  • bias: A 1D tensor of shape (n,)

Output: A 2D tensor of shape (m, n) where bias has been added to every row.

API Reference:

  • Both frameworks broadcast automatically: x + bias

Hints

broadcasting addition numpy-style
Detecting runtime...