Skip to content
ml-recall

#boolean-masks

2 questions from PyTorch, NumPy

Timed test

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

Take a test
Q 1 / 2Score 0 / 0

Question 1: Single choice

mediumAI-checkedPyTorch

The Tensor Puzzles replace an if-statement with this where. What is out.tolist()?

def where(q, a, b):
    return (q * a) + (~q) * b

q = torch.tensor([[False, True], [True, False]])
out = where(q, torch.tensor([[0], [10]]), torch.tensor([-10, 0]))
Choose one option