Hi, since I updated torch to 1.7 the transformations on my dataset don’t apply to my labels, even though I did not change anything. The transformations work fine on the normal data. Maybe somebody has a quick fix, here’s the code:
batch_size = 1

path_file = "data.csv"

train_inputs, train_labels, val_inputs, val_labels = BatchMaker.BatchMaker(path_file)


transform = transforms.Compose([
    transforms.ToPILImage(),
#     transforms.Resize((165, 220)),
    transforms.RandomRotation(degrees=random.randint(0,30)),
    transforms.RandomHorizontalFlip(p=0.5),
    transforms.RandomVerticalFlip(p=0.5),

])

class CreateDataset(Dataset):
    def __init__(self, inputs, labels, transform=transform):
        self.inputs = torch.FloatTensor(inputs)
        self.labels = torch.FloatTensor(labels)

        self.transform = transform
        
    def __getitem__(self, index):
        x = self.inputs[index]
        y = self.labels[index]
        
        if self.transform:
            seed = np.random.randint(2147483647) 
            random.seed(seed)

            x = self.transform(x)
            y = self.transform(y)
            if random.random() > 0.5:
                x = TF.adjust_brightness(x, random.uniform(0.4,0.6))

            if random.random() > 0.5:
                x = TF.adjust_contrast(x, random.uniform(0.4,0.6))
            x = TF.to_tensor(x)

            random.seed(seed)
            
            y = TF.to_tensor(y)
            
        y = y/np.sum(np.array(y))
        
        return x.view(1,180,240), y.view(1,180,240)

    def __len__(self):
        return len(self.inputs)

    
# Get the data, transform it
data = {
   'train':
   CreateDataset(train_inputs, train_labels),
   'val':
   CreateDataset(val_inputs, val_labels, transform=None),
#     'test':
#    CreateDataset(test_inputs, test_labels, transform=None)
}

# Load Data in batches, shuffled
dataloaders = {
   'train': DataLoader(data['train'], batch_size=batch_size, shuffle=True, drop_last=True),
   'val': DataLoader(data['val'], batch_size=batch_size, shuffle=False, drop_last=True),
#     'test': DataLoader(data['test'], batch_size=batch_size, shuffle=False, drop_last=True),
}