mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 00:20:18 +01:00
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166661 Approved by: https://github.com/mikaylagawarecki, https://github.com/albanD |
||
|---|---|---|
| .. | ||
| core | ||
| cpu/vec | ||
| macros | ||
| util | ||
| BUCK.oss | ||
| BUILD.bazel | ||
| build.bzl | ||
| CMakeLists.txt | ||
| ovrsource_defs.bzl | ||
| README.md | ||
| version.h.in | ||
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:
- 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. - 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 fromTORCH_CHECK.STD_TORCH_CHECKcalls intostd::runtime_errorinstead of relying onc10::Error, which relies on libtorch.so. As a result,STD_TORCH_CHECKdoes not have the fullTORCH_CHECKfunctionality 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.