Shortcuts

Shuffle

class torchdata.dataloader2.adapter.Shuffle(enable=True)

Shuffle DataPipes adapter allows control over all existing Shuffler (shuffle) DataPipes in the graph.

Parameters:

enable

Optional boolean argument to enable/disable shuffling in the DataPipe graph. True by default.

  • True: Enables all previously disabled ShufflerDataPipes. If none exists, it will add a new shuffle at the end of the graph.

  • False: Disables all ShufflerDataPipes in the graph.

  • None: No-op. Introduced for backward compatibility.

Example

>>>  dp = IterableWrapper(range(size)).shuffle()
>>>  dl = DataLoader2(dp, [Shuffle(False)])
>>>  self.assertEqual(list(range(size)), list(dl))

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources