Question 1: Single choice
mediumAI-checkedNeural Network BasicsWhat does this code print?
import torch
x = torch.tensor([-1.0, 0.0, 2.0], requires_grad=True)
torch.relu(x).sum().backward()
print(x.grad)16 questions from Neural Network Basics, Training Deep Networks, Deep Learning Frameworks, PyTorch
16 questions · 16 min · score and explanations at the end
What does this code print?
import torch
x = torch.tensor([-1.0, 0.0, 2.0], requires_grad=True)
torch.relu(x).sum().backward()
print(x.grad)