We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← Tensor Foundations step 4 of 7
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 + biasLoading visualization…
Nothing accepted yet. When a submission passes, the code that passed shows up
here, one entry per mode.
Stuck?
PyTorch reference solution
Sign in to attempt this problem and reveal the reference solution.