Skip to content
ml-recall

#diagonal

1 question from PyTorch

Timed test

1 question · 1 min · score and explanations at the end

Take a test
Q 1 / 1Score 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