@justusschock Dear Justus, thanks for your response.
Yes, I know what is  “ContactDataset”. But it mixes all Dataset Randomly.
Actually, I want to train two network which each network should train on the special dataset and finally I want to use their result to another network (For ensemble learning) while I should keep the shuffle.
In another word, I want to “targets1” and “targets2” be same.
Thanks again for your answer, my friend.
train_dl1 = torch.utils.data.DataLoader(train_ds1, batch_size=8,  shuffle=True, num_workers=8)                                 
train_dl2 = torch.utils.data.DataLoader(train_ds2, batch_size=8,                                      shuffle=True, num_workers=8)
inputs1, targets1 = next(iter(train_dl1))
inputs2, targets2 = next(iter(train_dl2))
targets1
tensor([ 1,  1,  0,  1,  0,  0,  1,  1])
targets2
tensor([ 0,  0,  0,  0,  0,  0,  0,  1])