函式庫版本控制¶
我們提供版本號碼巨集,用於識別正在使用的 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。