Solved by ptrblck in post #2 
              
              
                Could you check the values of your mask? Resizing a target mask without specifying an interpolation technique such as NEAREST might corrupt the mask tensor. 
Also, your model seems to output a single channel (1 class), while nn.NLLLoss is used for a multi-class classification use case (>= 2 classes)…