Repository navigation
Expand file tree
/
Copy pathrenderer.cpp
More file actions
executable file
·64 lines (59 loc) · 2.93 KB
/
Copy pathrenderer.cpp
File metadata and controls
executable file
·64 lines (59 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <torch/torch.h>
#include <vector>
std::vector<at::Tensor> ray_matching_cuda(
const at::Tensor w_h_3,
const at::Tensor w_h,
const at::Tensor grid,
const int width,
const int height,
const float bounding_box_min_x,
const float bounding_box_min_y,
const float bounding_box_min_z,
const float bounding_box_max_x,
const float bounding_box_max_y,
const float bounding_box_max_z,
const int grid_res_x,
const int grid_res_y,
const int grid_res_z,
const float eye_x,
const float eye_y,
const float eye_z);
#define CHECK_CUDA(x) AT_ASSERTM(x.type().is_cuda(), #x " must be a CUDA tensor")
#define CHECK_CONTIGUOUS(x) AT_ASSERTM(x.is_contiguous(), #x " must be contiguous")
#define CHECK_INPUT(x) CHECK_CUDA(x); CHECK_CONTIGUOUS(x)
std::vector<at::Tensor> ray_matching(
const at::Tensor w_h_3,
const at::Tensor w_h,
const at::Tensor grid,
const int width,
const int height,
const float bounding_box_min_x,
const float bounding_box_min_y,
const float bounding_box_min_z,
const float bounding_box_max_x,
const float bounding_box_max_y,
const float bounding_box_max_z,
const int grid_res_x,
const int grid_res_y,
const int grid_res_z,
const float eye_x,
const float eye_y,
const float eye_z) {
CHECK_INPUT(w_h_3);
CHECK_INPUT(w_h);
CHECK_INPUT(grid);
return ray_matching_cuda(w_h_3, w_h, grid, width, height,
bounding_box_min_x,
bounding_box_min_y,
bounding_box_min_z,
bounding_box_max_x,
bounding_box_max_y,
bounding_box_max_z,
grid_res_x,
grid_res_y,
grid_res_z,
eye_x, eye_y, eye_z);
}
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
m.def("ray_matching", &ray_matching, "Ray Matching");
}