Thanks @ptrblck! To be sure, the following will send batches of shuffled indices to the dataset __getitem__ ?
dataset = MyDataset(a, b)
loader = data.DataLoader(
    dataset,
    batch_sampler=data.BatchSampler(data.RandomSampler(dataset), 256, False),
    num_workers=4,
    pin_memory=True
)