Using LibTorch [PyTorch C++ API] in Another Projects

Hi,
I have installed LibTorch (PyTorch C++ API) successfully by following the instructions on Installing C++ Distributions of PyTorch. Now, I want to use it in another C++ Project. As I am newbie in CMake in Ubuntu, can anyone help me to implement a correct CMake file which with it I can use LibTorch in my C++ Projects?
As another question, In fact I am using CLion IDE for C++ coding in Ubuntu, so can anyone help me how I can write a correct CMake for my CLion C++ projects for using LibTorch?

2 Likes

Hi,

checkout this example. It pretty much the makefile from the example except that I added OpenCV as well.
From there on its just normal CMake!

1 Like

Dear @Tobias_Czempiel,
Thank you very much for your good tutorial.