Skip to content
← All tracks

Indexing and Selection

PyTorch

Two indexing systems wearing one syntax. Basic indexing hands you a window on the same memory; advanced indexing hands you a copy. Confusing them is the most common way a tensor bug becomes an aliasing bug.

0 / 9 solved
  1. 1. Not solved yet. The update that goes nowhere
  2. 2. Not solved yet. Pick one per row
  3. 3. Not solved yet. When two writes land on one slot
  4. 4. Not solved yet. Zero the padding, keep the tensor
  5. 5. Not solved yet. Mask the padding before the softmax
  6. 6. Not solved yet. The value at the argmax
  7. 7. Not solved yet. Rows 2 through 5, cheaply
  8. 8. Not solved yet. Everything above the threshold
  9. 9. Not solved yet. Labels to one-hot

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

What do x[-1] and dim=-1 mean?

x[-1]
x.sum(dim=-1)
Question 1 of 4