Writing a standalone c++ application with ATen

I’m following https://pytorch.org/tutorials/advanced/cpp_extension.html, but what i want to do is writing a standalone c++ application (it won’t be imported by python code).

I couldn’t find any documentation about ATen usage, so my question is what should I include? What should I put in my CMakeLists.txt?

I’ve included torch/torch.h in my code as the tutorial says and put
INCLUDE_DIRECTORIES(/home/anaconda3/lib/python3.6/site-packages/torch/lib/include)
in my CMakeLists, but I get
fatal error: Python.h: No such file or directory

Even if I try forcing the python include in the CMakeLists, I get other errors because it can’t find mkl, even if it’s installed, so I guess i’m doing something wrong.

I have pytorch 0.4 installed with conda.

1 Like

The same question.
Have you solved it?

Have a look at the libtorch C++ examples.
You can find the install instructions here.

Thank you.
By the way, My destination is a little different, I intend to write and debug the C code which can be directly imported into the pytorch code.
As the API of libtorch is different, I can’t directly use it to write C code.
So is there any suggestion about how should I write CMakeList to debug the pytorch cpp extension.