File tree Expand file tree Collapse file tree 4 files changed +64
-0
lines changed Expand file tree Collapse file tree 4 files changed +64
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "configurations" : [
3+ {
4+ "name" : " Linux" ,
5+ "includePath" : [
6+ " ${workspaceFolder}/**" ,
7+ " /home/ubuntu/anaconda3/envs/cppcuda/include/python3.8" ,
8+ " /home/ubuntu/anaconda3/envs/cppcuda/lib/python3.8/site-packages/torch/include" ,
9+ " /home/ubuntu/anaconda3/envs/cppcuda/lib/python3.8/site-packages/torch/include/torch/csrc/api/include"
10+ ],
11+ "defines" : [],
12+ "compilerPath" : " /usr/bin/clang" ,
13+ "cStandard" : " c17" ,
14+ "cppStandard" : " c++14" ,
15+ "intelliSenseMode" : " linux-clang-x64"
16+ }
17+ ],
18+ "version" : 4
19+ }
Original file line number Diff line number Diff line change 1+ #include < torch/extension.h>
2+
3+
4+ torch::Tensor trilinear_interpolation (
5+ torch::Tensor feats,
6+ torch::Tensor point
7+ ){
8+ return feats;
9+ }
10+
11+
12+ PYBIND11_MODULE (TORCH_EXTENSION_NAME, m){
13+ m.def (" trilinear_interpolation" , &trilinear_interpolation);
14+ }
Original file line number Diff line number Diff line change 1+ from setuptools import setup
2+ from torch .utils .cpp_extension import CppExtension , BuildExtension
3+
4+
5+ setup (
6+ name = 'cppcuda_tutorial' ,
7+ version = '1.0' ,
8+ author = 'kwea123' ,
9+ author_email = 'kwea123@gmail.com' ,
10+ description = 'cppcuda example' ,
11+ long_description = 'cppcuda example' ,
12+ ext_modules = [
13+ CppExtension (
14+ name = 'cppcuda_tutorial' ,
15+ sources = ['interpolation.cpp' ])
16+ ],
17+ cmdclass = {
18+ 'build_ext' : BuildExtension
19+ }
20+ )
Original file line number Diff line number Diff line change 1+ import torch
2+ import cppcuda_tutorial
3+
4+
5+ feats = torch .ones (2 )
6+ point = torch .zeros (2 )
7+
8+
9+ out = cppcuda_tutorial .trilinear_interpolation (feats , point )
10+
11+ print (out )
You can’t perform that action at this time.
0 commit comments