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


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?

(Tobias Czempiel) #2


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!


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