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
Traceback (most recent call last):
File "main_ce.py", line 333, in
main()
File "main_ce.py", line 302, in main
loss, train_acc = train(train_loader, model, criterion, optimizer, epoch, opt)
File "main_ce.py", line 214, in train
acc1, acc5 = accuracy(output, labels, topk=(1, 5))
File "/remote/idiap.svm/user.active/rkarimi/dev/internship/SupContrast/util.py", line 48, in accuracy
correct_k = correct[:k].view(-1).float().sum(0, keepdim=True)
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
The text was updated successfully, but these errors were encountered:
try change correct_k = correct[:k].view(-1).float().sum(0, keepdim=True) to correct_k = correct[:k].reshape(-1).float().sum(0, keepdim=True) in utils.py line 48
Hi I am running given example in README
thanks
Traceback (most recent call last):
File "main_ce.py", line 333, in
main()
File "main_ce.py", line 302, in main
loss, train_acc = train(train_loader, model, criterion, optimizer, epoch, opt)
File "main_ce.py", line 214, in train
acc1, acc5 = accuracy(output, labels, topk=(1, 5))
File "/remote/idiap.svm/user.active/rkarimi/dev/internship/SupContrast/util.py", line 48, in accuracy
correct_k = correct[:k].view(-1).float().sum(0, keepdim=True)
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
The text was updated successfully, but these errors were encountered: