The target tensor should be a LongTensor containing the class indices with the shape [batch_size, height, width].
Based on your shape description it looks like you are using an additional channel dimension.
Try to squeeze it via target = target.squeeze(1).