Cross Entropy Loss delivers wrong classes

@beaupreda, thanks for your feedback.

Following your feedback I proceed to change the values from Y (train and test) before these variables would be converted into tensor:

data.damage_grade.replace([1,2,3],[0,1,2], inplace=True)

I also tried following this [post] the(How to represent class_to_idx map for custom dataset in Pytorch) the following code, but I guess I do not know where to link it to.

idx_to_class = {
    ‘1’: “0”,
    ‘2’: “1”,
    ‘3’: “2”,
    }
sample_class = idx_to_class[label+1]

Unfortunately though, with either option, when I run the whole code the model would not train and return the following error:

RuntimeError: Assertion cur_target >= 0 && cur_target < n_classes' failed. at /pytorch/aten/src/THNN/generic/ClassNLLCriterion.c:97

I’d appreciate if you could let me know what your thoughts are.