It might be a silly question since I’m fairly new to pytorch but can you please explain me what following code is calculating?
x = torch.tensor([7.0], requires_grad=True)
y = x*x
y.backward(torch.tensor([2.0]))
print(x.grad)
output -> tensor([ 28.])
Tahaks