Solved by ptrblck in post #2 
              
              
                For 3 classes, your target should have the shape [batch_size] (which seems to be correct) and contain the values [0, 1, 2]. It seems you are using a value of 3, which will raise this error, as this would mean you are using 4 classes (note that the class index starts at 0).