Skip to content
ml-recall

#triangular-matrix

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

easyAI-checkedPyTorch

With arange(j) returning torch.tensor(range(j)), the one-liner

triu = 1 * (arange(j)[:, None] OP arange(j))

should return the upper triangular matrix of ones (out[r, c] = 1 when r <= c, else 0), as in Tensor Puzzle 6. Which operator OP is correct?

Choose one option