1Library Versioning 2================== 3 4We provide version number macros for identifying the version of LibTorch in use. 5Example usage: 6 7.. code-block:: cpp 8 9 #include <torch/torch.h> 10 #include <iostream> 11 12 int main() { 13 std::cout << "PyTorch version from parts: " 14 << TORCH_VERSION_MAJOR << "." 15 << TORCH_VERSION_MINOR << "." 16 << TORCH_VERSION_PATCH << std::endl; 17 std::cout << "PyTorch version: " << TORCH_VERSION << std::endl; 18 } 19 20This will output something like: 21 22.. code-block:: text 23 24 PyTorch version from parts: 1.8.0 25 PyTorch version: 1.8.0 26 27.. note:: 28 29 These macros are only available in PyTorch >= 1.8.0. 30