How to include torch/extension.h correctly?

Hi, I’m following this tutorial to extend torch to cpp/cuda.
My setup is Ubuntu 22, Visual Code, Cuda toolkit 12.1, torch install by conda.

>>> torch.version.cuda
>>> torch.__version__

I create my cpp file as follows:

#include <torch/extension.h>
#include <cuda.h>
#include <cuda_runtime.h>

// Forward pass 

// Backward pass 

In .vscode/c_cpp_properties.json, I added include path:

    "configurations": [
            "name": "Linux",
            "includePath": [
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c17",
            "cppStandard": "gnu++17",
            "intelliSenseMode": "linux-gcc-x64"
    "version": 4

But visual code still yields an error:

How can I fix this problem?

Thanks in advance!

I found that you should include “/torch/include/torch/csrc/api/include” before “/torch/include”