Ошибка выполнения при потере строки = критерий (y_pred, y_train)Ошибка:
Код: Выделить всё
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
in ()
8
9
---> 10 loss = criterion(y_pred, y_train)
11
12 # losses.append(loss.detach().numpy())
3 frames
/usr/local/lib/python3.10/dist-packages/torch/nn/functional.py in cross_entropy(input, target, weight, size_average, ignore_index, reduce, reduction, label_smoothing)
3084 if size_average is not None or reduce is not None:
3085 reduction = _Reduction.legacy_get_string(size_average, reduce)
-> 3086 return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)
3087
3088
IndexError: Target 32 is out of bounds.
Подробнее здесь: https://stackoverflow.com/questions/787 ... ony-pred-y