-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgridsample_cuda.cpp
57 lines (47 loc) · 1.77 KB
/
gridsample_cuda.cpp
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
#include <torch/extension.h>
#include <vector>
// CUDA forward declarations
namespace at {namespace native {
std::vector<torch::Tensor> grid_sample2d_cuda_grad2(
const torch::Tensor &grad2_grad_input,
const torch::Tensor &grad2_grad_grid,
const torch::Tensor &grad_output,
const torch::Tensor &input,
const torch::Tensor &grid,
bool padding_mode,
bool align_corners);
std::vector<torch::Tensor> grid_sample3d_cuda_grad2(
const torch::Tensor &grad2_grad_input,
const torch::Tensor &grad2_grad_grid,
const torch::Tensor &grad_output,
const torch::Tensor &input,
const torch::Tensor &grid,
bool padding_mode,
bool align_corners);
}}
std::vector<torch::Tensor> grid_sample2d_grad2(
const torch::Tensor &grad2_grad_input,
const torch::Tensor &grad2_grad_grid,
const torch::Tensor &grad_output,
const torch::Tensor &input,
const torch::Tensor &grid,
bool padding_mode,
bool align_corners) {
return at::native::grid_sample2d_cuda_grad2(grad2_grad_input, grad2_grad_grid,
grad_output, input, grid, padding_mode, align_corners);
}
std::vector<torch::Tensor> grid_sample3d_grad2(
const torch::Tensor &grad2_grad_input,
const torch::Tensor &grad2_grad_grid,
const torch::Tensor &grad_output,
const torch::Tensor &input,
const torch::Tensor &grid,
bool padding_mode,
bool align_corners) {
return at::native::grid_sample3d_cuda_grad2(grad2_grad_input, grad2_grad_grid,
grad_output, input, grid, padding_mode, align_corners);
}
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
m.def("grad2_2d", &grid_sample2d_grad2, "grid_sample2d second derivative");
m.def("grad2_3d", &grid_sample3d_grad2, "grid_sample3d second derivative");
}