Skip to content
ml-recall

#view

2 questions from Attention & Transformers, PyTorch

Timed test

2 questions · 2 min · score and explanations at the end

Take a test
Q 1 / 2Score 0 / 0

Question 1: Single choice

hardAI-checkedAttention & Transformers

x holds the keys of 3 tokens with 4 features each; token t has the features 4t, …, 4t + 3. Both lines below give shape (1, 2, 3, 2), i.e. (batch, heads, tokens, head_dim):

x = torch.arange(12).reshape(1, 3, 4)        # (batch, tokens, d_out)
right = x.view(1, 3, 2, 2).transpose(1, 2)   # as in MultiHeadAttention
wrong = x.view(1, 2, 3, 2)                   # skips the transpose

What does wrong[0, 0], the keys that "head 0" would use, contain?

Choose one option