PyTorch DataLoader and Parallelism
I have created a class that extends DataSet to load images for a segmentation task, so one input and one output. Every time the method getitem is called, this class performs the necessary operations for data augmentation on both the input and the output, and it works perfectly.

However, when I use this class with PyTorch DataLoader, the input transformation do not match with the output transformations. To perform the same operations, I have to get/set the states of random operations/classes, and my bet is that the DataLoader does the same, so there is a conflict between them.

How can I fix it?

The solution is to create a local instance of all the Random classes uses, because the DataLoader does not. Doing that, all the random transformations performed are according to random values/states that are not affected by the DataLoader. The common way to do it seems to create a class and put all the transformations inside.
