Question 1: Short answer
mediumAI-checkedDeep Learning FrameworksWhat does the last line print?
x = torch.tensor(2.0, requires_grad=True)
for _ in range(3):
y = x ** 2
y.backward()
print(x.grad)3 questions from Deep Learning Frameworks, PyTorch
3 questions · 3 min · score and explanations at the end
What does the last line print?
x = torch.tensor(2.0, requires_grad=True)
for _ in range(3):
y = x ** 2
y.backward()
print(x.grad)