Unit 3 : Quiz 3.4 #104
Answered
by
rasbt
bikash119
asked this question in
Lecture videos and quizzes
Unit 3 : Quiz 3.4
#104
-
The code to calculate calculate grad of f wrt y has a missing import import torch
import torch.autograd # missing.
x = torch.tensor(3.)
y = torch.tensor(2., requires_grad=True)
z = torch.tensor(5.)
f = 4 * x**3 + 3 * y**2 + 2*z
print(grad(f, y)) |
Beta Was this translation helpful? Give feedback.
Answered by
rasbt
Mar 15, 2024
Replies: 1 comment 1 reply
-
Thanks a lot for the note. I just updated it and added the missing |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
rasbt
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a lot for the note. I just updated it and added the missing
from torch.autograd import grad