ToTensor will normalize the input image, such that its output will have values in the range [0, 1].
While this is expected for input image tensors, this might be problematic, if you are dealing with mask images, which contain class indices.
Instead of ToTensor you should probably create the tensor via torch.from_numpy, which should keep the values. Also, I’m not sure, how save_image will act on the mask, so you should double check, that it doesn’t change the values either.