26/26
Part 4 of 4 · Multiply, reshape, and put it togetherCheck yourself
Check yourself
6 questions
1.
sqis a(3, 3)array. What doessq - sq.max(axis=1)do?2.What shape does
np.ones((8, 1, 5)) + np.ones((3, 1))produce?3.
qis(2, 4, 8, 16)andkis(2, 4, 10, 16): stacks of grids with 16 numbers in each row. Which line dots every row ofqwith every row ofk, grid by grid?4.
x = np.arange(6).reshape(2, 3). What isx.reshape(3, 2)[0]?5.
pis(4, 3)class probabilities andyis(4,)labels. What isp[:, y].shape?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