ShichenLiu / CondenseNet

CondenseNet: Light weighted CNN for mobile devices
MIT License
694 stars 131 forks source link

Issues with PyTorch 1.9.0 #40

Closed jakobjackson2016 closed 3 years ago

jakobjackson2016 commented 3 years ago

Getting the following error message:

Traceback (most recent call last): File "main.py", line 479, in <module> main() File "main.py", line 239, in main train(train_loader, model, criterion, optimizer, epoch) File "main.py", line 314, in train prec1, prec5 = accuracy(output.data, target, topk=(1, 5)) File "main.py", line 473, 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.

@lvdmaaten @ShichenLiu @gaohuang @ironfist2 Can CondenseNet be updated to be compatible with the latest PyTorch version 1.9.0? Or can you please tell us what changes need to be made?

Thank you!

EDIT: I just replaced the view function with reshape as suggested in the error and it works. Though I am still not sure of the difference between the two functions in this context.