pytorch/torch/utils
rzou 0f768c7866 Barebones flat_apply HOP (#146060)
This PR:
- adds pytree.register_constant for registering a class to be treated as
  a constant by torch.compile/torch.fx
- adds a very barebones flat_apply HOP. This should be sufficient to get
  mark_traceable working. A lot more work is necessary to get the custom
  operator case working (when make_fx sees a custom operator with PyTree
  arg types, it needs to emit a call to the flat_apply HOP).
- I expect the flat_apply HOP to change a lot, I want to ship this in
  the current state to unblock the mark_traceable and custom ops
  work.

Test Plan:
- It's kind of difficult to test the barebones flat_apply HOP "works" so
  I added a really simple test.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/146060
Approved by: https://github.com/StrongerXi, https://github.com/yanboliang
ghstack dependencies: #146059
2025-02-01 16:17:48 +00:00
..
_strobelight PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
_sympy Allow replacing unbacked with very large upperbound by returning no-op for FloorToInt(int) (#146001) 2025-01-31 00:25:20 +00:00
backcompat
benchmark PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
bottleneck PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
data Backout PEP585 use of Iterable (#145438) 2025-01-23 11:45:37 +00:00
hipify PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
jit PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
model_dump PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
serialization Add option to serialization config to reduce random reads from get_record_offset when loading with mmap=True (#143880) 2025-01-31 17:09:20 +00:00
tensorboard PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
viz PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
__init__.py
_backport_slots.py PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
_config_module.py config: Don't spam warnings about reference type configs (#145800) 2025-01-30 18:57:16 +00:00
_config_typing.pyi
_content_store.py PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
_contextlib.py
_cpp_embed_headers.py PEP585: Missed conversions (#145342) 2025-01-29 05:24:36 +00:00
_cpp_extension_versioner.py
_cxx_pytree.py [AOTI] Cache treespec_loads calculation (#145815) 2025-01-31 06:38:21 +00:00
_device.py Revert "Fix torch.normal ignores default_device (#144070)" 2025-01-14 17:41:58 +00:00
_exposed_in.py
_filelock.py
_foreach_utils.py PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
_freeze.py PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
_functools.py
_get_clean_triton.py PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
_import_utils.py remove allow-untyped-defs from utils/_import_utils.py (#144089) 2025-01-03 01:21:13 +00:00
_mode_utils.py
_ordered_set.py [BE]: Update typing of OrderedSet ancestor (#145783) 2025-01-28 04:43:49 +00:00
_python_dispatch.py PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
_pytree.py Barebones flat_apply HOP (#146060) 2025-02-01 16:17:48 +00:00
_stats.py PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
_thunk.py
_traceback.py PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
_triton.py
_typing_utils.py Revert "Fix type annotation of Linear.bias (#142326)" 2025-01-26 03:41:00 +00:00
_zip.py
backend_registration.py PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
bundled_inputs.py PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
checkpoint.py [BE] typing for decorators (#144161) 2025-01-04 16:40:09 +00:00
collect_env.py Revert "Collect packages with importlib in collect_env (#144616)" 2025-01-13 03:11:04 +00:00
cpp_backtrace.py
cpp_extension.py Set -DPy_LIMITED_API flag for py_limited_api=True extensions (#145764) 2025-01-28 20:11:05 +00:00
deterministic.py
dlpack.py
file_baton.py
flop_counter.py PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
hooks.py PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
mkldnn.py
mobile_optimizer.py PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
model_zoo.py
module_tracker.py PEP585 update - torch/utils (#145201) 2025-01-21 21:04:10 +00:00
show_pickle.py Use typing.IO[bytes] instead of io.BytesIO in annotations (#144994) 2025-01-27 18:08:07 +00:00
throughput_benchmark.py
weak.py