pytorch-randaugment icon indicating copy to clipboard operation
pytorch-randaugment copied to clipboard

view size is not compatible with input tensor's size and stride

Open Srigowri opened this issue 4 years ago • 1 comments

I am trying to reproduce the output for ! python RandAugment/train.py -c confs/wresnet28x10_svhn_b256.yaml --save svhn_wres28x10.pth The error is encountered in the metrics.py correct_k = correct[:k].view(-1).float().sum(0)

Error message : view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces)

The same error arises while testing for cifar10

Srigowri avatar Feb 11 '21 08:02 Srigowri

hi, i meet the same problem as yours. Because the view function need the tensor address is continuous, if discontinuous, you should add the contiguous function before view . Now I can run this code :)

XiaoFengbing avatar Nov 13 '22 13:11 XiaoFengbing