tankche1 / Semantic-Feature-Augmentation-in-Few-shot-Learning

Semantic Feature Augmentation in Few-shot Learning
87 stars 11 forks source link

How can i fix the error when run the classify.py? Which says inconsistent tensor sizes. #8

Closed myfighterforever closed 5 years ago

myfighterforever commented 5 years ago

@tankche1 Hi, when I run your train code, I met a problem. Can you help me? Thank you very much! The logs: Epoch 0/99

0it [00:00, ?it/s]Traceback (most recent call last): File "classification.py", line 159, in embedding_lr_scheduler, num_epochs=100) File "classification.py", line 94, in train_model for i,(inputs,labels) in tqdm(enumerate(dataloaders[phase])): File "/home/maoying/pytorch_project/venv/local/lib/python2.7/site-packages/tqdm/_tqdm.py", line 979, in iter for obj in iterable: File "/home/maoying/pytorch_project/venv/local/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 201, in next return self._process_next_batch(batch) File "/home/maoying/pytorch_project/venv/local/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 221, in _process_next_batch raise batch.exc_type(batch.exc_msg) RuntimeError: Traceback (most recent call last): File "/home/maoying/pytorch_project/venv/local/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 40, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/maoying/pytorch_project/venv/local/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 109, in default_collate return [default_collate(samples) for samples in transposed] File "/home/maoying/pytorch_project/venv/local/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 91, in default_collate return torch.stack(batch, 0, out=out) File "/home/maoying/pytorch_project/venv/local/lib/python2.7/site-packages/torch/functional.py", line 66, in stack return torch.cat(inputs, dim, out=out) RuntimeError: inconsistent tensor sizes at /pytorch/torch/lib/TH/generic/THTensorMath.c:2709