Skip to content
ml-recall

#off-by-one

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

An attempt at Tensor Puzzle 11 (reverse a vector of length i) is written as a[i - arange(i)]. What happens here?

def arange(i):
    return torch.tensor(range(i))

a = torch.tensor([10, 20, 30, 40])
out = a[4 - arange(4)]
Choose one option