Learn practical skills, build real-world projects, and advance your career
import torch
x=torch.tensor(3.)
y=torch.tensor(4.,requires_grad=True)
z=torch.tensor(5.,requires_grad=True)
f=y*x+z
f
tensor(17., grad_fn=<AddBackward0>)
f.backward()
print(x.grad)
print(y.grad)
print(z.grad)
None tensor(3.) tensor(1.)