What min and max values does the target contain?
The shape looks OK after you squeeze it, if target is a LongTensor and contains the class indices in the range  [0, nb_classes-1].



 7029279:

Also a side question. Is there any way to make masks out of xy coordinates? do people code tehir own script everytime?


I would guess that you could find some good implementations in this discussion board or alternatively for numpy (which should be easily portable to PyTorch)