Here is the code from the tutorial.
x = Variable(torch.ones(2, 2), requires_grad=True)
y = x + 2
print(y.grad_fn)
Python interpreter showed the message below:
Traceback (most recent call last):
File “/media/wx/Windows/Test/pytorch learning/tutorial.py”, line 85, in
print(y.grad_fn)
File “/usr/local/lib/python2.7/dist-packages/torch/autograd/variable.py”, line 63, in getattr
raise AttributeError(name)
AttributeError: grad_fn
The pytorch version is 0.1.12_2. Is that outdated? I just install it with pip under the instructions from official website.