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

batch_size issue #40

Open
buttercutter opened this issue Apr 14, 2021 · 2 comments
Open

batch_size issue #40

buttercutter opened this issue Apr 14, 2021 · 2 comments

Comments

@buttercutter
Copy link

I ran python search.py --name cifar10 --dataset cifar10 --batch_size 32 , but I have the following error at utils.py. Why ?

Traceback (most recent call last):
  File "/home/phung/Downloads/darts/pt.darts/search.py", line 201, in <module>
    main()
  File "/home/phung/Downloads/darts/pt.darts/search.py", line 84, in main
    train(train_loader, valid_loader, model, architect, w_optim, alpha_optim, lr, epoch)
  File "/home/phung/Downloads/darts/pt.darts/search.py", line 144, in train
    prec1, prec5 = utils.accuracy(logits, trn_y, topk=(1, 5))
  File "/home/phung/Downloads/darts/pt.darts/utils.py", line 103, 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.
@buttercutter
Copy link
Author

Problem solved using https://github.com/promach/pt.darts/

@skbhat
Copy link

skbhat commented Aug 1, 2021

First apply .contiguous() before view. Eg:

correct_k = correct[:k].view(-1).float().sum(0) must be changed to correct_k = correct[:k].contiguous().view(-1).float().sum(0)

Suggested by cezannec/capsule_net_pytorch#4

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

2 participants