I think it’s more likely that the error is here:



 DeepLearner17:

loss = nn.CrossEntropyLoss()(y, y_target)


Can you print the sizes of y, y_target and y_target.min() and y_target.max()? Maybe y_target has some values outside of the class index range.