庫版本管理#
我們提供版本號宏來標識正在使用的 LibTorch 的版本。示例用法
#include <torch/torch.h>
#include <iostream>
int main() {
std::cout << "PyTorch version from parts: "
<< TORCH_VERSION_MAJOR << "."
<< TORCH_VERSION_MINOR << "."
<< TORCH_VERSION_PATCH << std::endl;
std::cout << "PyTorch version: " << TORCH_VERSION << std::endl;
}
這將輸出類似如下的內容
PyTorch version from parts: 1.8.0
PyTorch version: 1.8.0
注意
這些宏僅在 PyTorch >= 1.8.0 版本中可用。