human-analysis / neural-architecture-transfer

Neural Architecture Transfer (Arxiv'20), PyTorch Implementation
http://hal.cse.msu.edu/papers/neural-architecture-transfer/
152 stars 21 forks source link

IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1) #5

Closed NEUdeep closed 3 years ago

NEUdeep commented 3 years ago

root@workspace-job-5fadedfbbf46a9bf616072f7-qnp4z:# sh run.sh M2 train val No horovod in environment Running validation on imagenet Data processing configuration for current model + dataset: input_size: (3, 224, 224) interpolation: bicubic mean: (0.485, 0.456, 0.406) std: (0.229, 0.224, 0.225) crop_pct: 0.875 Model created, param count: 7688312 Traceback (most recent call last): File "evaluator.py", line 109, in main(cfgs) File "evaluator.py", line 83, in main validate(model, test_loader, criterion) File "evaluator.py", line 29, in validate loss = criterion(output, target) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, **kwargs) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/loss.py", line 916, in forward ignore_index=self.ignore_index, reduction=self.reduction) File "/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py", line 2021, in cross_entropy return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction) File "/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py", line 1317, in log_softmax ret = input.log_softmax(dim) IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)

hello, when I evaluator your model in imagenet, but I got this error, can you have any advice? thanks.

NEUdeep commented 3 years ago

I solve it, by set batch_size > 1