-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Closed
Description
This snippet used to work, but now throws an error:
In [1]: import torch
In [2]: torch.__version__
Out[2]: '0.2.0_4'
In [3]: from torch.autograd import Variable
In [4]: 1 - Variable(torch.cuda.ByteTensor(2).fill_(1))
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-d11efaae512d> in <module>()
----> 1 1 - Variable(torch.cuda.ByteTensor(2).fill_(1))
/home/dexter/anaconda2/lib/python2.7/site-packages/torch/autograd/variable.pyc in __rsub__(self, other)
824
825 def __rsub__(self, other):
--> 826 return SubConstant.apply(other, self)
827
828 def __mul__(self, other):
/home/dexter/anaconda2/lib/python2.7/site-packages/torch/autograd/_functions/basic_ops.pyc in forward(ctx, a, b, inplace)
128 return tensor.neg_().add_(constant)
129 else:
--> 130 return tensor.neg().add_(constant)
131
132 @staticmethod
AttributeError: 'torch.cuda.ByteTensor' object has no attribute 'neg'
Metadata
Metadata
Assignees
Labels
No labels