Sundrops / video-caption.pytorch

MIT License
32 stars 18 forks source link

Aother bug : train_loss = loss.data[0] IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number #5

Closed tuyunbin closed 5 years ago

tuyunbin commented 5 years ago

Problem train_loss = loss.data[0] IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

Solution: Change train_loss = loss.data[0] to train_loss = loss.item()