WZMIAOMIAO / deep-learning-for-image-processing

deep learning for image processing including classification and object-detection etc.
GNU General Public License v3.0
22.61k stars 7.94k forks source link

dimension does not match tensor #646

Closed XuJ1E closed 2 years ago

XuJ1E commented 2 years ago

Traceback (most recent call last): File "train.py", line 124, in main(opt) File "train.py", line 87, in main train_loss, train_acc = train_one_epoch(model=model, File "F:\ImageClassification\EmotionClassification\utils.py", line 142, in train_one_epoch accu_num += torch.eq(pred_classes, labels.to(device)).sum() RuntimeError: The size of tensor a (256) must match the size of tensor b (2) at non-singleton dimension 2


Thanks for your wnoderful works, and here I have some problems about the dimension of batch_size, like up, is the batch_size not a tensor vector?

WZMIAOMIAO commented 2 years ago

Sorry, I don't know. Maybe some code you changed cause this error.