ReCU icon indicating copy to clipboard operation
ReCU copied to clipboard

evaluation error

Open SoyedTuhinAhmed opened this issue 2 years ago • 1 comments

During evaluation i get following errors

Traceback (most recent call last): File "/home/ahmsoy00/Projects/DATE23_Invited_Variational_Bayes/classification/CIFAR-10/ReCU/main.py", line 319, in main() File "/home/ahmsoy00/Projects/DATE23_Invited_Variational_Bayes/classification/CIFAR-10/ReCU/main.py", line 118, in main val_loss, val_prec1, val_prec5 = validate(val_loader, model, criterion, 0) File "/home/ahmsoy00/Projects/DATE23_Invited_Variational_Bayes/classification/CIFAR-10/ReCU/main.py", line 314, in validate return forward(data_loader, model, criterion, epoch, File "/home/ahmsoy00/Projects/DATE23_Invited_Variational_Bayes/classification/CIFAR-10/ReCU/main.py", line 275, in forward prec1, prec5 = accuracy(output.data, target, topk=(1, 5)) File "/home/ahmsoy00/Projects/DATE23_Invited_Variational_Bayes/classification/CIFAR-10/ReCU/utils/common.py", line 70, in accuracy correct_k = correct[:k].view(-1).float().sum(0)

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.

SoyedTuhinAhmed avatar Jan 10 '23 15:01 SoyedTuhinAhmed

I SoyedTuhinAhmed,

As the RuntimeError said, you must change .view() by .reshape(), you can apply the following change:

correct_k = correct[:k].reshape(-1).float().sum(0)

Enmartz avatar May 25 '24 12:05 Enmartz