It helps deverlopers to setup PyTorch C++ Project on Windows without CMake. Developers could setup a new libTorch project in Visual Studio with one click. Now, VS 2019 and 2022 are supported
LibTorch Project Template for VS2019
LibTorch Project Template for VS2022
Pytorch.org only provide the latest libtorch binary links. Generally, the libtorch download links
For example
Libtorch {1.11.0 cu113 debug} download link is
https://download.pytorch.org/libtorch/cu113/libtorch-win-shared-with-deps-debug-1.11.0%2Bcu113.zip
If it's a cpu version, the {cuda-version} is cpu
https://blog.csdn.net/guzhao9901/article/details/125051108
- Change
Project settings->Configuration Properties->General->Configuration Type
toDynamic Library(.dll)
- Change
Project settings->Configuration Properties->Advanced->Target File Extension
todll
#include <torch/torch.h>
extern "C" __declspec(dllexport) int check_cuda()
{
if (torch::cuda::is_available()) {
return 1;
}
else
{
return 0;
}
}
https://ossci-windows.s3.us-east-1.amazonaws.com/vsextension/demo.mp4)