Use linux based pytorch model in windows c++ code

I am looking forward to the best way to use my linux based pytorch model to the c++ program in windows.
Can someone please guide me to the best options?

You can follow the export to C++ tutorial, the export format is the same on Windows and Linux, so you can make the step Python on Linux to C++ on Windows.

Best regards

Thomas

Thanks, I tried following the tutorial as it is but i am facing issues in building the application via cmake.

This is my error report:

D:\work\torchscript\example-app\example-app\build>cmake -DCMAKE_PREFIX_PATH=D:/work/torchscript/libtorch …
– Caffe2: CUDA detected: 10.0
– Caffe2: CUDA nvcc is: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/bin/nvcc.exe
– Caffe2: CUDA toolkit directory: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0
CMake Error at D:/work/torchscript/libtorch/share/cmake/Caffe2/public/cuda.cmake:74 (message):
Caffe2: Couldn’t determine version from header: Change Dir:
D:/work/torchscript/example-app/example-app/build/dCYT4/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual
Studio/2017/Professional/MSBuild/15.0/Bin/MSBuild.exe cmTC_c9077.vcxproj
/p:Configuration=Debug /p:Platform=x86 /p:VisualStudioVersion=15.0 /v:m &&
Microsoft ® Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright © Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Microsoft Visual
Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets(65,5):
error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset =
‘v100’) cannot be found. To build using the v100 build tools, please
install Visual Studio 2010 build tools. Alternatively, you may upgrade to
the current Visual Studio tools by selecting the Project menu or
right-click the solution, and then selecting “Retarget solution”.
[D:\work\torchscript\example-app\example-app\build\dCYT4\CMakeFiles\CMakeTmp\cmTC_c9077.vcxproj]

Call Stack (most recent call first):
D:/work/torchscript/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:88 (include)
D:/work/torchscript/libtorch/share/cmake/Torch/TorchConfig.cmake:40 (find_package)
CMakeLists.txt:4 (find_package)

– Configuring incomplete, errors occurred!
See also “D:/work/torchscript/example-app/example-app/build/CMakeFiles/CMakeOutput.log”.
See also “D:/work/torchscript/example-app/example-app/build/CMakeFiles/CMakeError.log”.

So here I must admit that I know next to zero about building things for windows, but if you have the 2010 build tools installed (have you?), you might need to include them into the PATH.
To me, this seems to be something around how to build general things on Windows more than PyTorch specific.

Best regards

Thomas