pytorch/torch/headeronly
2025-10-31 17:18:13 +00:00
..
core Hide APIs in torch::headeronly (#166079) 2025-10-25 00:18:26 +00:00
cpu/vec Hide APIs in torch::headeronly (#166079) 2025-10-25 00:18:26 +00:00
macros Add a compile-time flag to trigger verbose logging for device-side asserts (#166171) 2025-10-30 19:43:46 +00:00
util Hide APIs in torch::headeronly (#166079) 2025-10-25 00:18:26 +00:00
BUCK.oss Migrate c10/macros/cmake_macros.h.in to torch/headeronly (#158035) 2025-07-15 19:52:59 +00:00
BUILD.bazel Migrate c10/macros/cmake_macros.h.in to torch/headeronly (#158035) 2025-07-15 19:52:59 +00:00
build.bzl Move version.h to torch/headeronly (#164381) 2025-10-07 17:47:30 +00:00
CMakeLists.txt [Reland] Migrate ScalarType to headeronly (#159911) 2025-08-06 07:36:37 +00:00
ovrsource_defs.bzl Move version.h to torch/headeronly (#164381) 2025-10-07 17:47:30 +00:00
README.md Document LibTorch ABI more, add README to headeronly (#166661) 2025-10-31 17:18:13 +00:00
version.h.in Add TORCH_TARGET_VERSION for stable ABI (#164356) 2025-10-29 15:41:28 +00:00

torch/headeronly

The inlined C++ headers in the torch::headeronly namespace living this subdirectory are completely decoupled from LibTorch. These APIs are also globally listed in torch/header_only_apis.txt.

There are two types of LibTorch independent header-only headers:

  1. OG header-only. Originally header-only APIs, such as ScalarType, Half, BFloat16, have always been implemented in headers only. For them to move into torch/headeronly only required a code migration, a copy-pasta, if you will.
  2. Made to be header-only. There are also APIs that were NOT header-only that we made to be header-only. One example of such an API is STD_TORCH_CHECK, which was derived from TORCH_CHECK. STD_TORCH_CHECK calls into std::runtime_error instead of relying on c10::Error, which relies on libtorch.so. As a result, STD_TORCH_CHECK does not have the full TORCH_CHECK functionality that displays a fanciful traceback when the check is not met. We intentionally maintain the design that functions that do different things should be explicitly named differently.