vision_cpu.h 3.01 KB
Newer Older
1
2
#pragma once
#include <torch/extension.h>
3
#include "../macros.h"
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
VISION_API at::Tensor DeformConv2d_forward_cpu(
    const at::Tensor& input,
    const at::Tensor& weight,
    const at::Tensor& offset,
    const at::Tensor& bias,
    int64_t stride_h,
    int64_t stride_w,
    int64_t pad_h,
    int64_t pad_w,
    int64_t dilation_h,
    int64_t dilation_w,
    int64_t groups,
    int64_t deformable_groups);

VISION_API std::tuple<at::Tensor, at::Tensor, at::Tensor, at::Tensor>
DeformConv2d_backward_cpu(
    const at::Tensor& grad_out,
    const at::Tensor& input,
    const at::Tensor& weight,
    const at::Tensor& offset,
    const at::Tensor& bias,
    int64_t stride_h,
    int64_t stride_w,
    int64_t pad_h,
    int64_t pad_w,
    int64_t dilation_h,
    int64_t dilation_w,
    int64_t groups,
    int64_t deformable_groups);

VISION_API at::Tensor nms_cpu(
    const at::Tensor& dets,
    const at::Tensor& scores,
    double iou_threshold);

VISION_API std::tuple<at::Tensor, at::Tensor> PSROIAlign_forward_cpu(
    const at::Tensor& input,
    const at::Tensor& rois,
    double spatial_scale,
    int64_t pooled_height,
    int64_t pooled_width,
    int64_t sampling_ratio);

VISION_API at::Tensor PSROIAlign_backward_cpu(
    const at::Tensor& grad,
    const at::Tensor& rois,
    const at::Tensor& channel_mapping,
    double spatial_scale,
    int64_t pooled_height,
    int64_t pooled_width,
    int64_t sampling_ratio,
    int64_t batch_size,
    int64_t channels,
    int64_t height,
    int64_t width);

VISION_API std::tuple<at::Tensor, at::Tensor> PSROIPool_forward_cpu(
62
63
    const at::Tensor& input,
    const at::Tensor& rois,
64
65
66
    double spatial_scale,
    int64_t pooled_height,
    int64_t pooled_width);
67

68
VISION_API at::Tensor PSROIPool_backward_cpu(
69
70
    const at::Tensor& grad,
    const at::Tensor& rois,
71
    const at::Tensor& channel_mapping,
72
73
74
75
76
77
78
    double spatial_scale,
    int64_t pooled_height,
    int64_t pooled_width,
    int64_t batch_size,
    int64_t channels,
    int64_t height,
    int64_t width);
79

80
VISION_API at::Tensor ROIAlign_forward_cpu(
81
82
    const at::Tensor& input,
    const at::Tensor& rois,
83
84
85
86
87
    double spatial_scale,
    int64_t pooled_height,
    int64_t pooled_width,
    int64_t sampling_ratio,
    bool aligned);
88

89
VISION_API at::Tensor ROIAlign_backward_cpu(
90
91
    const at::Tensor& grad,
    const at::Tensor& rois,
92
93
94
95
96
97
98
99
100
    double spatial_scale,
    int64_t pooled_height,
    int64_t pooled_width,
    int64_t batch_size,
    int64_t channels,
    int64_t height,
    int64_t width,
    int64_t sampling_ratio,
    bool aligned);
101

102
VISION_API std::tuple<at::Tensor, at::Tensor> ROIPool_forward_cpu(
103
104
    const at::Tensor& input,
    const at::Tensor& rois,
105
106
    double spatial_scale,
    int64_t pooled_height,
107
    int64_t pooled_width);
108

109
VISION_API at::Tensor ROIPool_backward_cpu(
110
111
    const at::Tensor& grad,
    const at::Tensor& rois,
112
    const at::Tensor& argmax,
113
114
115
116
117
118
119
    double spatial_scale,
    int64_t pooled_height,
    int64_t pooled_width,
    int64_t batch_size,
    int64_t channels,
    int64_t height,
    int64_t width);