if you are doing image segmentation with PixelWise, just use CrossEntropyLoss over your output channel dimension.
BCEWithLogitsLoss is needed when you have soft-labels (i.e. instead of {dog at (1, 1), cat at (4, 20)} it is like {dog with strength 0.3 at (1,1), …}