You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, when python train.py was executed I faced an odd error:
Traceback (most recent call last):
File "D:\a-PyTorch-Tutorial-to-Image-Captioning\train.py", line 332, in <module>
main()
File "D:\a-PyTorch-Tutorial-to-Image-Captioning\train.py", line 111, in main
train(train_loader=train_loader,
File "D:\a-PyTorch-Tutorial-to-Image-Captioning\train.py", line 207, in train
top5 = accuracy(scores, targets, 5)
File "D:\a-PyTorch-Tutorial-to-Image-Captioning\utils.py", line 283, in accuracy
batch_size = targets.size(0)
AttributeError: 'PackedSequence' object has no attribute 'size'
So, what can I do?
Thank you.
The text was updated successfully, but these errors were encountered:
Traceback (most recent call last):
File "train.py", line 328, in
main()
File "train.py", line 116, in main
epoch=epoch)
File "train.py", line 204, in train
top5 = accuracy(scores, targets, 5)
File "/workspace/data/a-PyTorch-Tutorial-to-Image-Captioning/utils.py", line 286, in accuracy
batch_size = targets.batch_sizes(0)
TypeError: 'Tensor' object is not callable
Getting this error with the suggested change, can u pls tell me how to make it work
@MCA-eng According to the TypeError message you can know targets.batch_sizes is of Tensor type, it cannot be called through () like functions, you should try [] to index.
Hello, when
python train.py
was executed I faced an odd error:So, what can I do?
Thank you.
The text was updated successfully, but these errors were encountered: