26/26
Part 4 of 4 · Multiply, reshape, and put it togetherCheck yourself
Check yourself
6 questions
  1. 1.sq is a (3, 3) array. What does sq - sq.max(axis=1) do?

  2. 2.What shape does np.ones((8, 1, 5)) + np.ones((3, 1)) produce?

  3. 3.q is (2, 4, 8, 16) and k is (2, 4, 10, 16): stacks of grids with 16 numbers in each row. Which line dots every row of q with every row of k, grid by grid?

  4. 4.x = np.arange(6).reshape(2, 3). What is x.reshape(3, 2)[0]?

  5. 5.p is (4, 3) class probabilities and y is (4,) labels. What is p[:, y].shape?

  6. 6.You mask entries by setting their scores to 0 instead of -inf. What happens after the softmax?

That's the lesson.
Now the problem this lesson builds to: 27 NumPy axes, broadcasting and stacksPractice it