Solved by ptrblck in post #2 
              
              
                One simple approach would be to use batch_size=2 in the DataLoader and add the sampling logic to Dataset.__getitem__. 
This method would get the two indices as its index argument, and you could use this index to sample the desired paired sample. If you want or need, you could also use a BatchSampler,…