Using the SequentialSampler as shown in this 4 line, a couple lines below the above.  You can find more information about it at https://pytorch.org/docs/stable/data.html#torch.utils.data.SequentialSampler 8