23/23
Part 6 of 6 · One decode step, and long linesCheck yourself
Check yourself
6 questions
1.
xis(B, T, C)and you need(B, H, T, d)heads. Which line is right?2.
yis the(B, H, T, d)output ofatt @ v. What doesy.transpose(1, 2).view(B, T, C)do?3.
allowed = torch.tril(torch.ones(3, 3, dtype=torch.bool)). What doesatt.masked_fill(allowed, float('-inf')).softmax(dim=-1)give?4.
qkvis(B, T, 3C)with C = 64. Which call gives q, k and v, each(B, T, C)?5.
logitsis(B, T, V). Which gives a(B, 1)tensor of greedy ids to append toidx?6.
lin = nn.Linear(512, 1536)andxis(8, 128, 512). What arelin.weight.shapeandlin(x).shape?
That's the lesson.Next lesson: Scaled dot-product attention
Now the problem this lesson builds to: 28 Tensor shapes for attention (PyTorch)Practice it