pytorch/torch/csrc/stable
Jane Xu fe69a2bbbd Move from/to to torch::stable::detail (#164956)
To not pollute the global namespace, we should move the `from`/`to` APIs into torch::stable::detail. We are also following our normal deprecation cycle and choosing to continue exposing the global `from`/`to` for the time being as people who onboard their extensions onto 2.9 would not be able to build with 2.10 otherwise.

Note that this means that within libtorch, we do not get the luxury of tacking on a `using torch::stable::detail::from` because then it leads to build time ambiguous calls --> both the global and namespace APIs are exposed, which one do I want? So that is why you see every local site is updated.

Note that the update is _not_ necessary from a custom op writer point of view. FA3 can continue to build on torch nightlies without changing any code. (Since this is a header change, this PR has no implication on runtime, a previously built FA3 ABI stable wheel will continue to work fine with newer torch versions after this PR.)

Once TORCH_BOX lands, we would be free to remove these global APIs when the deprecation cycle is up (April 2026) and encourage people to use TORCH_BOX and avoid from/to entirely.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/164956
Approved by: https://github.com/malfet
ghstack dependencies: #164882
2025-10-21 02:59:46 +00:00
..
.clang-tidy Don't use declarations in global namespace in stable headers (#163352) 2025-09-19 21:15:52 +00:00
accelerator.h Don't use declarations in global namespace in stable headers (#163352) 2025-09-19 21:15:52 +00:00
library.h Add ScalarType -> shim conversion, add stable::Tensor.scalar_type (#160557) 2025-08-19 22:13:47 +00:00
ops.h Move from/to to torch::stable::detail (#164956) 2025-10-21 02:59:46 +00:00
stableivalue_conversions.h Move from/to to torch::stable::detail (#164956) 2025-10-21 02:59:46 +00:00
tensor_inl.h Move from/to to torch::stable::detail (#164956) 2025-10-21 02:59:46 +00:00
tensor_struct.h Add ScalarType -> shim conversion, add stable::Tensor.scalar_type (#160557) 2025-08-19 22:13:47 +00:00
tensor.h Add ScalarType -> shim conversion, add stable::Tensor.scalar_type (#160557) 2025-08-19 22:13:47 +00:00