Skip to content
ml-recall

#advanced-indexing

3 questions from PyTorch

Timed test

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

Take a test
Q 1 / 3Score 0 / 0

Question 1: Single choice

mediumAI-checkedPyTorch
def arange(i):
    return torch.tensor(range(i))

m = torch.arange(9).reshape(3, 3)   # [[0, 1, 2], [3, 4, 5], [6, 7, 8]]

Which expression returns the diagonal tensor([0, 4, 8])?

Choose one option