Solved by ptrblck in post #2 
              
              
                You could use e.g. sklearn.model_selection.StratifiedShuffleSplit (or any other suitable splitting function) to create the split indices. 
Once you have the indices, you could pass your dataset together with the split indices to a Subset and pass it then to a DataLoader.