Traceback (most recent call last):
File "train.py", line 488, in <module>
train_acc = trainepoch(epoch)
File "train.py", line 428, in trainepoch
all_costs.append(loss.item())
File "/home/lucas/.local/lib/python3.5/site-packages/torch/autograd/variable.py", line 67, in __getattr__
return object.__getattribute__(self, name)
AttributeError: 'Variable' object has no attribute 'item'
when calling:
python3 train.py --gpu_id 0 --test_data twitter
I got:
since
print(type(loss),loss)
gives:Shouldn't it be
loss.data[0]
?