Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: view size is not compatible with input tensor's size and stride #1

Open
adaaaaaa opened this issue Aug 17, 2021 · 0 comments

Comments

@adaaaaaa
Copy link

adaaaaaa commented Aug 17, 2021

python test.py --arch small
08/17 02:53:34 PM gpu device = 0
08/17 02:53:34 PM args = Namespace(data='../data', batch_size=96, lr=0.025, momentum=0.9, wd=0.0003, report_freq=50, gpu=0, epochs=600, layers=20, model_path='saved_models', auxiliary_weight=0.4, cutout=False, cutout_length=16, drop_path_prob=0.2, seed=0, arch='small', save='EXP')
08/17 02:53:37 PM param size = 3.789982MB
Files already downloaded and verified
/home/captain/.local/lib/python3.9/site-packages/torch/nn/functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at /pytorch/c10/core/TensorImpl.h:1156.)
return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode)
tensor(95., device='cuda:0')
Traceback (most recent call last):
File "/home/captain/competition/study/Few-shot-NAS/Few-Shot-NAS_cifar10/test.py", line 134, in
main()
File "/home/captain/competition/study/Few-shot-NAS/Few-Shot-NAS_cifar10/test.py", line 97, in main
valid_acc, valid_obj = infer(valid_queue, model, criterion)
File "/home/captain/competition/study/Few-shot-NAS/Few-Shot-NAS_cifar10/test.py", line 117, in infer
prec1, prec5 = utils.accuracy(logits, target, topk=(1, 5))
File "/home/captain/competition/study/Few-shot-NAS/Few-Shot-NAS_cifar10/utils.py", line 43, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant