AttributeError: ‘Tensor’ object has no attribute ‘creator’
p>
according to the official pytorch documentation, the variable has the above three properties, but the error of not having this property appears when the creator property of the y operation is obtained.
import torch
from torch.autograd import Variable
x = Variable(torch.ones(1,3), requires_grad=True)
y = x+2
print('x: ', x)
print('y: ', y)
print(y.creator)
after checking, it is found that the name of creator property has been changed to grad_fn, and many documents have not been modified
on making commits: https://github.com/pytorch/tutorials/pull/91/files p>
after modification, run again, you can get the property Variable
of the created Function property of y
import torch
from torch.autograd import Variable
x = Variable(torch.ones(1,3), requires_grad=True)
y = x+2
print('x: ', x)
print('y: ', y)
print(y.grad_fn)
Read More:
- AttributeError: ‘Tensor‘ object has no attribute ‘_numpy‘
- Attributeerror: ‘module’ object has no attribute ‘handlers’ — Python sub module import problem
- AttributeError: ‘numpy.ndarray‘ object has no attribute ‘softmax‘
- Attributeerror: object has no attribute
- PyTorch – AttributeError: ‘bool‘ object has no attribute ‘sum‘
- AttributeError: ‘NoneType‘ object has no attribute ‘append‘
- AttributeError: type object ‘Image‘ has no attribute ‘open‘
- Attributeerror: ‘bytes’ object has no attribute’ encode ‘
- Attributeerror: ‘dataframe’ object has no attribute ‘IX’ error
- AttributeError: ‘dict‘ object has no attribute ‘iteritems‘
- AttributeError: ‘Settings’ object has no attribute ‘ROOT_URLCONF’
- AttributeError:‘AxesSubplot’object has no attribute‘bar_label’
- Debug | AttributeError: ‘numpy.int64‘ object has no attribute ‘to_pydatetime‘
- AttributeError: ‘PipelinedRDD‘ object has no attribute ‘toDF‘
- AttributeError: ‘WebDriver‘ object has no attribute ‘w3c‘
- Python AttributeError: ‘bool‘ object has no attribute ‘ui‘
- AttributeError: ‘NoneType‘ object has no attribute ‘shape‘
- AttributeError: ‘_io.TextIOWrapper‘ object has no attribute ‘softspace‘
- Solution: attributeerror: type object ‘ioloop’ has no attribute ‘initialized’
- python gensim AttributeError: ‘Doc2Vec‘ object has no attribute ‘dv‘