data icon indicating copy to clipboard operation
data copied to clipboard

MultiplexerLongest example snippet isn't very useful

Open lendle opened this issue 2 years ago • 0 comments

📚 The doc issue

https://pytorch.org/data/0.6/generated/torchdata.datapipes.iter.MultiplexerLongest.html#torchdata.datapipes.iter.MultiplexerLongest

The snippet in the docs

>>> from torchdata.datapipes.iter import IterableWrapper
>>> dp1, dp2, dp3 = IterableWrapper(range(5)), IterableWrapper(range(10, 15)), IterableWrapper(range(20, 25))
>>> list(dp1.mux_longest(dp2, dp3))
[0, 10, 20, 1, 11, 21, 2, 12, 22, 3, 13, 23, 4, 14, 24]

The three input datapipes all have the same length so the example doesn't show why this is different than Multiplexer.

Suggest a potential alternative/fix

Change the example so that one input datapipe is shorter in order to show why this is different than Multiplexer

lendle avatar Jun 12 '23 15:06 lendle