Spaces:
Build error
Build error
First model version
Browse files
maskrcnn_benchmark/csrc/dcn_v2.h
CHANGED
|
@@ -22,7 +22,7 @@ dcn_v2_forward(const at::Tensor &input,
|
|
| 22 |
const int dilation_w,
|
| 23 |
const int deformable_group)
|
| 24 |
{
|
| 25 |
-
if (input.
|
| 26 |
{
|
| 27 |
#ifdef WITH_CUDA
|
| 28 |
return dcn_v2_cuda_forward(input, weight, bias, offset, mask,
|
|
@@ -35,7 +35,14 @@ dcn_v2_forward(const at::Tensor &input,
|
|
| 35 |
AT_ERROR("Not compiled with GPU support");
|
| 36 |
#endif
|
| 37 |
}
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
}
|
| 40 |
|
| 41 |
std::vector<at::Tensor>
|
|
@@ -51,7 +58,7 @@ dcn_v2_backward(const at::Tensor &input,
|
|
| 51 |
int dilation_h, int dilation_w,
|
| 52 |
int deformable_group)
|
| 53 |
{
|
| 54 |
-
if (input.
|
| 55 |
{
|
| 56 |
#ifdef WITH_CUDA
|
| 57 |
return dcn_v2_cuda_backward(input,
|
|
@@ -69,7 +76,19 @@ dcn_v2_backward(const at::Tensor &input,
|
|
| 69 |
AT_ERROR("Not compiled with GPU support");
|
| 70 |
#endif
|
| 71 |
}
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
}
|
| 74 |
|
| 75 |
std::tuple<at::Tensor, at::Tensor>
|
|
@@ -85,7 +104,7 @@ dcn_v2_psroi_pooling_forward(const at::Tensor &input,
|
|
| 85 |
const int sample_per_part,
|
| 86 |
const float trans_std)
|
| 87 |
{
|
| 88 |
-
if (input.
|
| 89 |
{
|
| 90 |
#ifdef WITH_CUDA
|
| 91 |
return dcn_v2_psroi_pooling_cuda_forward(input,
|
|
@@ -103,7 +122,19 @@ dcn_v2_psroi_pooling_forward(const at::Tensor &input,
|
|
| 103 |
AT_ERROR("Not compiled with GPU support");
|
| 104 |
#endif
|
| 105 |
}
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
}
|
| 108 |
|
| 109 |
std::tuple<at::Tensor, at::Tensor>
|
|
@@ -121,7 +152,7 @@ dcn_v2_psroi_pooling_backward(const at::Tensor &out_grad,
|
|
| 121 |
const int sample_per_part,
|
| 122 |
const float trans_std)
|
| 123 |
{
|
| 124 |
-
if (input.
|
| 125 |
{
|
| 126 |
#ifdef WITH_CUDA
|
| 127 |
return dcn_v2_psroi_pooling_cuda_backward(out_grad,
|
|
@@ -141,5 +172,19 @@ dcn_v2_psroi_pooling_backward(const at::Tensor &out_grad,
|
|
| 141 |
AT_ERROR("Not compiled with GPU support");
|
| 142 |
#endif
|
| 143 |
}
|
| 144 |
-
|
| 145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
const int dilation_w,
|
| 23 |
const int deformable_group)
|
| 24 |
{
|
| 25 |
+
if (input.is_cuda())
|
| 26 |
{
|
| 27 |
#ifdef WITH_CUDA
|
| 28 |
return dcn_v2_cuda_forward(input, weight, bias, offset, mask,
|
|
|
|
| 35 |
AT_ERROR("Not compiled with GPU support");
|
| 36 |
#endif
|
| 37 |
}
|
| 38 |
+
else{
|
| 39 |
+
return dcn_v2_cpu_forward(input, weight, bias, offset, mask,
|
| 40 |
+
kernel_h, kernel_w,
|
| 41 |
+
stride_h, stride_w,
|
| 42 |
+
pad_h, pad_w,
|
| 43 |
+
dilation_h, dilation_w,
|
| 44 |
+
deformable_group);
|
| 45 |
+
}
|
| 46 |
}
|
| 47 |
|
| 48 |
std::vector<at::Tensor>
|
|
|
|
| 58 |
int dilation_h, int dilation_w,
|
| 59 |
int deformable_group)
|
| 60 |
{
|
| 61 |
+
if (input.is_cuda())
|
| 62 |
{
|
| 63 |
#ifdef WITH_CUDA
|
| 64 |
return dcn_v2_cuda_backward(input,
|
|
|
|
| 76 |
AT_ERROR("Not compiled with GPU support");
|
| 77 |
#endif
|
| 78 |
}
|
| 79 |
+
else{
|
| 80 |
+
return dcn_v2_cpu_backward(input,
|
| 81 |
+
weight,
|
| 82 |
+
bias,
|
| 83 |
+
offset,
|
| 84 |
+
mask,
|
| 85 |
+
grad_output,
|
| 86 |
+
kernel_h, kernel_w,
|
| 87 |
+
stride_h, stride_w,
|
| 88 |
+
pad_h, pad_w,
|
| 89 |
+
dilation_h, dilation_w,
|
| 90 |
+
deformable_group);
|
| 91 |
+
}
|
| 92 |
}
|
| 93 |
|
| 94 |
std::tuple<at::Tensor, at::Tensor>
|
|
|
|
| 104 |
const int sample_per_part,
|
| 105 |
const float trans_std)
|
| 106 |
{
|
| 107 |
+
if (input.is_cuda())
|
| 108 |
{
|
| 109 |
#ifdef WITH_CUDA
|
| 110 |
return dcn_v2_psroi_pooling_cuda_forward(input,
|
|
|
|
| 122 |
AT_ERROR("Not compiled with GPU support");
|
| 123 |
#endif
|
| 124 |
}
|
| 125 |
+
else{
|
| 126 |
+
return dcn_v2_psroi_pooling_cpu_forward(input,
|
| 127 |
+
bbox,
|
| 128 |
+
trans,
|
| 129 |
+
no_trans,
|
| 130 |
+
spatial_scale,
|
| 131 |
+
output_dim,
|
| 132 |
+
group_size,
|
| 133 |
+
pooled_size,
|
| 134 |
+
part_size,
|
| 135 |
+
sample_per_part,
|
| 136 |
+
trans_std);
|
| 137 |
+
}
|
| 138 |
}
|
| 139 |
|
| 140 |
std::tuple<at::Tensor, at::Tensor>
|
|
|
|
| 152 |
const int sample_per_part,
|
| 153 |
const float trans_std)
|
| 154 |
{
|
| 155 |
+
if (input.is_cuda())
|
| 156 |
{
|
| 157 |
#ifdef WITH_CUDA
|
| 158 |
return dcn_v2_psroi_pooling_cuda_backward(out_grad,
|
|
|
|
| 172 |
AT_ERROR("Not compiled with GPU support");
|
| 173 |
#endif
|
| 174 |
}
|
| 175 |
+
else{
|
| 176 |
+
return dcn_v2_psroi_pooling_cpu_backward(out_grad,
|
| 177 |
+
input,
|
| 178 |
+
bbox,
|
| 179 |
+
trans,
|
| 180 |
+
top_count,
|
| 181 |
+
no_trans,
|
| 182 |
+
spatial_scale,
|
| 183 |
+
output_dim,
|
| 184 |
+
group_size,
|
| 185 |
+
pooled_size,
|
| 186 |
+
part_size,
|
| 187 |
+
sample_per_part,
|
| 188 |
+
trans_std);
|
| 189 |
+
}
|
| 190 |
+
}
|