Skip to content
ml-recall

#saliency-map

4 questions from Explainable AI

Timed test

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

Take a test
Q 1 / 4Score 0 / 0

Question 1: Short answer

mediumAI-checkedExplainable AI

What does this code print?

import torch
import torch.nn as nn

lin = nn.Linear(3, 2, bias=False)
with torch.no_grad():
    lin.weight.copy_(torch.tensor([[1.0, -2.0, 0.5],
                                   [0.3, 0.7, -1.5]]))
x = torch.tensor([[5.0, 1.0, 0.2]], requires_grad=True)
score = lin(x)[0, 1]
score.backward()
sal = x.grad.abs()
print(sal.argmax().item())

an integer index