I don’t think this problem is related to the DataLoader. Because in this class, you are not mixing the two tensors t_images and t_masks. I think the problem happens later on in your code. For a test, can you just get the size of tensors loaded from the data_loader:
batch_x, batch_y = next(iter(data_loade))
print(batch_x.shape, batch_y.shape)

If this works, then we can confirm that there is no problem with MyDataset class that you have defined.