-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding mux_longest
DataPipe
#372
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
facebook-github-bot
added
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
labels
Apr 26, 2022
This pull request was exported from Phabricator. Differential Revision: D35805772 |
NivekT
approved these changes
Apr 26, 2022
ninginthecloud
added a commit
to ninginthecloud/data
that referenced
this pull request
Apr 27, 2022
Summary: Pull Request resolved: pytorch#372 OSS issue discussion: pytorch#346 This diff updates `mux_longest` data pipe. `mux_longest`: Yields one element at a time from each of the input Iterable DataPipes (functional name: ``mux_longest``). As in, one element from the 1st input DataPipe, then one element from the 2nd DataPipe in the next iteration, and so on. It skips over DataPipes that are exhausted, and ends when all input DataPipes are exhausted. This is same as current `MultiplexerIterDataPipe` in pytorch (https://github.com/pytorch/pytorch/blob/4fb7fa081e4fb5df3bf7bc85dcb9a3a9a3ac7133/torch/utils/data/datapipes/iter/combining.py#L375-L390) `mux_longest` example: ``` >>> 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] ``` Reviewed By: NivekT, ejguan Differential Revision: D35805772 fbshipit-source-id: 095409427cf3714fb5f94bd99a090a6603526225
ninginthecloud
force-pushed
the
export-D35805772
branch
from
April 27, 2022 00:05
89d1b46
to
271300d
Compare
This pull request was exported from Phabricator. Differential Revision: D35805772 |
ninginthecloud
added a commit
to ninginthecloud/data
that referenced
this pull request
Apr 27, 2022
Summary: Pull Request resolved: pytorch#372 OSS issue discussion: pytorch#346 This diff updates `mux_longest` data pipe. `mux_longest`: Yields one element at a time from each of the input Iterable DataPipes (functional name: ``mux_longest``). As in, one element from the 1st input DataPipe, then one element from the 2nd DataPipe in the next iteration, and so on. It skips over DataPipes that are exhausted, and ends when all input DataPipes are exhausted. This is same as current `MultiplexerIterDataPipe` in pytorch (https://github.com/pytorch/pytorch/blob/4fb7fa081e4fb5df3bf7bc85dcb9a3a9a3ac7133/torch/utils/data/datapipes/iter/combining.py#L375-L390) `mux_longest` example: ``` >>> 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] ``` Reviewed By: NivekT, ejguan Differential Revision: D35805772 fbshipit-source-id: db629550c51a5cd9ac90ee77e9942686f995e079
ninginthecloud
force-pushed
the
export-D35805772
branch
from
April 27, 2022 17:40
271300d
to
7cf40fb
Compare
This pull request was exported from Phabricator. Differential Revision: D35805772 |
1 similar comment
This pull request was exported from Phabricator. Differential Revision: D35805772 |
ninginthecloud
added a commit
to ninginthecloud/data
that referenced
this pull request
Apr 28, 2022
Summary: Pull Request resolved: pytorch#372 OSS issue discussion: pytorch#346 This diff updates `mux_longest` data pipe. `mux_longest`: Yields one element at a time from each of the input Iterable DataPipes (functional name: ``mux_longest``). As in, one element from the 1st input DataPipe, then one element from the 2nd DataPipe in the next iteration, and so on. It skips over DataPipes that are exhausted, and ends when all input DataPipes are exhausted. This is same as current `MultiplexerIterDataPipe` in pytorch (https://github.com/pytorch/pytorch/blob/4fb7fa081e4fb5df3bf7bc85dcb9a3a9a3ac7133/torch/utils/data/datapipes/iter/combining.py#L375-L390) `mux_longest` example: ``` >>> 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] ``` Reviewed By: NivekT, ejguan Differential Revision: D35805772 fbshipit-source-id: 91d4c09fb8b956492f3322463d9b19ac40b8ad78
ninginthecloud
force-pushed
the
export-D35805772
branch
from
April 28, 2022 05:50
7cf40fb
to
fbfd72d
Compare
Summary: Pull Request resolved: pytorch#372 OSS issue discussion: pytorch#346 This diff updates `mux_longest` data pipe. `mux_longest`: Yields one element at a time from each of the input Iterable DataPipes (functional name: ``mux_longest``). As in, one element from the 1st input DataPipe, then one element from the 2nd DataPipe in the next iteration, and so on. It skips over DataPipes that are exhausted, and ends when all input DataPipes are exhausted. This is same as current `MultiplexerIterDataPipe` in pytorch (https://github.com/pytorch/pytorch/blob/4fb7fa081e4fb5df3bf7bc85dcb9a3a9a3ac7133/torch/utils/data/datapipes/iter/combining.py#L375-L390) `mux_longest` example: ``` >>> 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] ``` Reviewed By: NivekT, ejguan Differential Revision: D35805772 fbshipit-source-id: 1d467c8fa8b6eac0d2b47a21779b73346ec07ebd
ninginthecloud
force-pushed
the
export-D35805772
branch
from
May 6, 2022 22:24
fbfd72d
to
b96a3af
Compare
This pull request was exported from Phabricator. Differential Revision: D35805772 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
OSS issue discussion: #346
This diff updates
mux_longest
data pipe.mux_longest
: Yields one element at a time from each of the input Iterable DataPipes (functional name:mux_longest
). As in, one element from the 1st input DataPipe, then one element from the 2nd DataPipe in the next iteration, and so on. It skips over DataPipes that are exhausted, and ends when all input DataPipes are exhausted. This is same as currentMultiplexerIterDataPipe
in pytorch (https://github.com/pytorch/pytorch/blob/4fb7fa081e4fb5df3bf7bc85dcb9a3a9a3ac7133/torch/utils/data/datapipes/iter/combining.py#L375-L390)mux_longest
example:Reviewed By: NivekT, ejguan
Differential Revision: D35805772