Zipper¶
- class torchdata.datapipes.iter.Zipper(*datapipes: IterDataPipe)¶
Aggregates elements into a tuple from each of the input DataPipes (functional name:
zip
). The output is stopped as soon as the shortest input DataPipe is exhausted.- Parameters:
*datapipes – Iterable DataPipes being aggregated
Example
>>> from torchdata.datapipes.iter import IterableWrapper >>> dp1, dp2, dp3 = IterableWrapper(range(5)), IterableWrapper(range(10, 15)), IterableWrapper(range(20, 25)) >>> list(dp1.zip(dp2, dp3)) [(0, 10, 20), (1, 11, 21), (2, 12, 22), (3, 13, 23), (4, 14, 24)]