Shortcuts

torchtnt.utils.data.MultiIterator

class torchtnt.utils.data.MultiIterator(individual_dataloaders: Mapping[str, Union[DataLoader, Iterable]], iteration_strategy: DataIterationStrategy)

MultiIterator defines the iteration logic to get a batch, given batches from all individual dataloaders. iteration_strategy can include accompanying parameters for a particular iterator, like cycling order for the dataloaders.

Parameters:
  • individual_dataloaders (Mapping[str, Union[DataLoader, Iterable]]) – A mapping of DataLoaders or Iterables with dataloader name as key and dataloader/iterable object as value.
  • iteration_strategy (DataIterationStrategy) – A dataclass indicating how the dataloaders are iterated over.

Note

TorchData (https://pytorch.org/data/beta/index.html) also has generic multi-data
sources reading support to achieve the same functionality provided by MultiIterator.

For example, mux, mux_longest, cycle, zip etc. Please refer to the documentation for more details.

__init__(individual_dataloaders: Mapping[str, Union[DataLoader, Iterable]], iteration_strategy: DataIterationStrategy) None

Methods

__init__(individual_dataloaders, ...)

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