Skip to content
← All tracks

Broadcasting

PyTorch

The rules in full, then the bugs they enable. A missing `unsqueeze` does not raise — it silently produces an (n, n) where you meant an (n,), and every number downstream is wrong but plausible.

0 / 6 solved
  1. 1. Not solved yet. A stride of zero
  2. 2. Not solved yet. Every pair at once
  3. 3. Not solved yet. Which side may stretch
  4. 4. Not solved yet. What shape comes out
  5. 5. Not solved yet. The outer product, three ways
  6. 6. Not solved yet. One bias, every position

Check yourself

4 questions · one attempt each

These do not count toward finishing the track. They are here to catch the things that are easy to read past.

0 / 4

a is (3,1) and b is (1,4). a + b gives (3,4). What does a.add_(b) do?

a = torch.ones(3, 1)
b = torch.ones(1, 4)
a + b        # (3, 4)
a.add_(b)    # ?
Question 1 of 4