Hello,
I think that your targets should be something like B x 1 x H x W.
where B is your batch size, H and W height and width of your image.
The target should be a long tensor with the class value for every pixel (0 if it is class 1 at pixel, 1 if classe 2 etc…)