Add a flatmap datapipe
See original GitHub issueš The feature
Add a FlatMapDataPipe
which simulataneously flattens nested IterDataPipe
s and applies a function to nested pipes.
Motivation, pitch
I have tarballs containing tarballs. When dealing with these types of recursive data, itās useful to have a mechanism to both flatten the structure and apply a function to it so I only need to consider the āinner-mostā data.
Alternatives
Domain libraries can define their own impls.
Additional context
Migrating torchtext to datapipes via torchdata would benefit from this feature when dealing with IWSLT data.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
FlatMapper ā TorchData main documentation - PyTorch
Applies a function over each item from the source DataPipe, then flattens the outputs to a single, unnested IterDataPipe (functional name: flatmap )....
Read more >How to create DataPipe that best optimize the map-transform ...
I've tried to process the X efficiently by kind of using .flatmap() but I don't even know whether I'm really using the autobot_vectorizeĀ ......
Read more >Chainer/Concater from single datapipe? Ā· Issue #648 - GitHub
The Concater datapipe takes multiple DPs as input. Is there a class that would take a single datapipe of iterables instead?
Read more >Java 8 flatMap example - Mkyong.com
This article explains the Java 8 Stream flatMap() and how to use it. ... we can loop the 2d array and put all...
Read more >Data Pipe | Vis Data
The following example shows how to use a Data Pipe to divide app specific and Vis ... .flatMap 's argument is a function...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Technical speaking, this
flatmap
can also be applied in your use case. The function becomes a generator yielding dataā¦Yes, the pseudocode I have in mind is basically
So the flatmapād
read_from_tar
becomes the generator yielding data andflatmap
flattens it into aIterableDataPipe
. I think the test Iāve written doesnāt actually reflect this usecase š¬ but thatās a thought for the PR