Transforming inside CustomDataset or inside CustomDataloader - which is better? pytorch

Do I want to apply transformations to augment data inside the CustomDataloader class in Pytorch, or should I do it in the CustomDataset class? I would be grateful if you could show an example of how to use it correctly.

You would usually create a custom Dataset and would not change anything in the DataLoader.
This tutorial shows how to create a custom Dataset and how to apply the transformations in the __getitem__ method.

1 Like