Pytorch error when i try to train my data


2 frames

/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py in cross_entropy(input, target, weight, size_average, ignore_index, reduce, reduction, label_smoothing) 2994 if size_average is not None or reduce is not None: 2995 reduction = _Reduction.legacy_get_string(size_average, reduce) → 2996 return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing) 2997 2998

ValueError: Expected input batch_size (150000) to match target batch_size (50000).

Apparently there is batch size mismatch in the tensors you gave to loss function.
You gave 150k predictions to compare with 50k targets in your loss function.
You should post give n predictions to compare with n targets.

Have a good day :slight_smile:

Thank you it worked (-1,32323)