Usually you would pass the transformation to a Dataset, not the DataLoader.
You could use e.g. torchvision.datasets.ImageFolder 1 and pass it as transform=your_transform.
Alternatively, you could write your own Dataset and apply the transformation in the __getitem__ method.