pytorch/torch/utils
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
..
backcompat
benchmark Fix import of instruction count benchmark (#85359) 2022-09-21 17:17:47 +00:00
bottleneck Fix use-dict-literal lint (#83718) 2022-08-24 00:26:46 +00:00
data [DataLoader] Replacing traverse function with traverse_datapipes (#85667) 2022-09-27 19:58:15 +00:00
hipify Update hipification logic for all ROCm headers (#85320) 2022-09-21 16:22:12 +00:00
jit
model_dump
tensorboard Fix use-dict-literal lint (#83718) 2022-08-24 00:26:46 +00:00
__init__.py Expose cpp_backtrace to python binding (#84896) 2022-09-27 14:59:08 +00:00
_cpp_extension_versioner.py
_crash_handler.py
_cuda_trace.py Add synchronize hooks (#84427) 2022-09-09 13:56:59 +00:00
_freeze.py
_mode_utils.py [Modes] remove enable and rewrite mode stack (squashed) (#84774) 2022-09-27 01:04:35 +00:00
_python_dispatch.py [Modes] remove enable and rewrite mode stack (squashed) (#84774) 2022-09-27 01:04:35 +00:00
_pytree.py Add SymFloat, support SymInt to SymFloat conversion (#84284) 2022-09-03 01:30:32 +00:00
_zip.py Use multipy.package in multipy/runtime (#111) (#82690) 2022-08-03 19:11:12 +00:00
bundled_inputs.py
checkpoint.py Integrate xdoctest - Rebased (#82797) 2022-08-12 02:08:01 +00:00
collect_env.py
cpp_backtrace.py Expose cpp_backtrace to python binding (#84896) 2022-09-27 14:59:08 +00:00
cpp_extension.py Add __all__ to torch.utils submodules (#85331) 2022-09-27 14:45:26 +00:00
dlpack.py More doctest refinements. (#83317) 2022-08-22 20:07:26 +00:00
file_baton.py
hooks.py Add __all__ to torch.utils submodules (#85331) 2022-09-27 14:45:26 +00:00
mkldnn.py
mobile_optimizer.py
model_zoo.py
show_pickle.py Add __all__ to torch.utils submodules (#85331) 2022-09-27 14:45:26 +00:00
throughput_benchmark.py More doctest refinements. (#83317) 2022-08-22 20:07:26 +00:00