Hi @ptrblck, revisiting this old post of mine to clarify one more thing about the label tensor. I see that nn.CrossEntropyLoss() does not need the output and target tensor to be of the same size and I could compare  the output of having 2 channels: [1,2,16,64,64] with the binary target having only a single channel [1,16,64,64]. And as our sample code it is working fine for me with my data as well.
But from what I understand DiceLoss() and BinaryCrossEntropy() need both to be of the same size. If I want to use such loss criterion how can I have my label tensor to be 2 channels? Can I make a label tensor to have 2 channels? one for background and one for foreground? Or would it be better to change the last layer of the network to output only a single channel and output a size [1,1,16,64,64]?
Thank you