Missing class in training set

Hi, there seems to be an issue when some class is not present in the training set but in the test/validation set. For example, for MNIST classification, if I take out all digit ‘0’ from the training set, I got the error ‘RuntimeError: expected scalar type Long but found Float’ at step ‘train_loss += criterion(output, categorized_label[i].view(-1))’ under ‘model.eval()’, likely for a . I couldn’t see why in principle missing one class during training should pose such a problem. In my setting this missing of one class is necessary so for the time being I can only add very few data for that supposedly missing class as a compromise.

Removing a class shouldn’t raise a dtype mismatch, so could you post an executable, minimal code snippet to reproduce the issue, please?

Hi thanks for the reply. Turns out it was because there was something wrong with the way I preprocess the data. Thanks for letting me know it wasn’t supposed to be the error so that I can troubleshoot it effectively.