Solved by ptrblck in post #2 
              
              
                For a multi-class segmentation use case, you should use nn.CrossEntropyLoss where the model output should be a FloatTensor in the shape [batch_size, nb_classes, height, width] and the target a LongTensor in the shape [batch_size, height, width] containing the class indices in the range [0, nb_classe…