i have a dataset object called total_loader
when initialized, it has an attribute called flip transform which is a torch.nn.module object.
i then create train and validation dataloaders by:
train_loader = Subset(total_loader,train_idx)
val_loader = Subset(total_loader,val_idx)
training_generator = DataLoader(train_loader, **params)
val_generator = DataLoader(val_loader, **params)


in the dataset object the  get_item func checks whether self.flip_transform is not none and if so applies the transform, like this:
in get item…
if self.flip_transform is not None:
    y = self.flip_transform(y)
    return y

i want this behavior to happen only during training. i tried to manually set the flip_transform attribute back to none for the validation dataset only, but i see the change in both datasets.
i try something like this:
val_generator.dataset.dataset.flip_transform = None

this changes both train and validation generators back to None!
what should i do?