pytorch/torch/utils/data
Kevin Tse 64a526d4af [DataLoader] Replacing traverse function with traverse_datapipes (#85667)
This PR deprecates `traverse` function and replaces it with `traverse_datapipes` instead.

While use `DataLoader`, I realized that it is raising `FutureWarning` even though I am not explicitly using `traverse`. What is happening is that `DataLoader` invokes `traverse(dp, only_datapipe=True)`, and the usage of the keyword causes the `only_datapipe` warning to be raised.

```
/home/ubuntu/miniconda3/lib/python3.8/site-packages/torch/utils/data/graph.py:102: FutureWarning: `only_datapipe` is deprecated from `traverse` function and will be removed after 1.13.
  warnings.warn(msg, FutureWarning)
```

A few things we'd like to do:
1. Deprecate the key word arg `only_datapipe`
2. Change the default behavior from `only_datapipe=False` to `only_datapipe=True` in the future
3. Do not raise a warning when users are using the function correctly

This creates a paradox it is impossible for the users to change their code to match the future default behavior (i.e. call `traverse(dp)` without `only_datapipe`):
  - they cannot do so because the default behavior of `traverse` hasn't changed yet, so they must use `only_datapipe=True`
  - if they use `only_datapipe=True`, eventually the kwarg will go away and cause a runtime error; they also get a `FutureWarning` in the present

IIUC, there doesn't seem to be a way to accomplish those 3 goals without replacing the function with a new one that has a different name; hence, this PR. Let me know if there is a better alternative.

If this looks right, I will send a follow up PR in `TorchData`.

Differential Revision: [D39832183](https://our.internmc.facebook.com/intern/diff/D39832183)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85667
Approved by: https://github.com/ejguan
2022-09-27 19:58:15 +00:00
..
_utils [DataLoader] Make distributed lazily initialized & share seed via PG (#85279) 2022-09-23 18:52:52 +00:00
communication
datapipes Add support to traverse all python collection objects (#84079) 2022-09-23 16:21:25 +00:00
__init__.py
backward_compatibility.py [DataLoader] DataLoader now automatically apply sharding to DataPipes 2022-06-02 17:40:29 +00:00
dataframes_pipes.ipynb
dataloader_experimental.py [DLv2] Make graph traverse working with unhashable DataPipe (#80509) 2022-07-12 14:47:42 +00:00
dataloader.py [DataLoader] Make distributed lazily initialized & share seed via PG (#85279) 2022-09-23 18:52:52 +00:00
dataset.py More doctest refinements. (#83317) 2022-08-22 20:07:26 +00:00
distributed.py Integrate xdoctest - Rebased (#82797) 2022-08-12 02:08:01 +00:00
graph_settings.py [DataLoader] Replacing traverse function with traverse_datapipes (#85667) 2022-09-27 19:58:15 +00:00
graph.py [DataLoader] Replacing traverse function with traverse_datapipes (#85667) 2022-09-27 19:58:15 +00:00
sampler.py Integrate xdoctest - Rebased (#82797) 2022-08-12 02:08:01 +00:00
standard_pipes.ipynb
typing.ipynb