import torch
from torch.autograd import Variable
x = Variable(torch.ones(2, 2), requires_grad=True)
y = x + 2
z = y * y * 3
out = z.mean()
out.backward()
In this example, only the gradient of x can be avaliable, but how to achieve the gradient of y?