Skip to content

Commit b54486e

Browse files
ppwwyyxxfacebook-github-bot
authored andcommitted
add namespace to all C code
Reviewed By: rbgirshick Differential Revision: D17917015 fbshipit-source-id: a5faa5c534f16c3f5b155064e9df48ad27c21f69
1 parent dfdaae1 commit b54486e

File tree

8 files changed

+185
-137
lines changed

8 files changed

+185
-137
lines changed

detectron2/layers/csrc/ROIAlign/ROIAlign.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#pragma once
33
#include <torch/extension.h>
44

5+
namespace detectron2 {
6+
57
at::Tensor ROIAlign_forward_cpu(
68
const at::Tensor& input,
79
const at::Tensor& rois,
@@ -124,3 +126,5 @@ inline at::Tensor ROIAlign_backward(
124126
sampling_ratio,
125127
aligned);
126128
}
129+
130+
} // namespace detectron2

detectron2/layers/csrc/ROIAlign/ROIAlign_cpu.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#include <ATen/TensorUtils.h>
33
#include "ROIAlign.h"
44

5+
namespace {
6+
57
// implementation taken from Caffe2
68
template <typename T>
79
struct PreCalc {
@@ -391,6 +393,10 @@ void ROIAlignBackward(
391393
} // for
392394
} // ROIAlignBackward
393395

396+
} // namespace
397+
398+
namespace detectron2 {
399+
394400
at::Tensor ROIAlign_forward_cpu(
395401
const at::Tensor& input,
396402
const at::Tensor& rois,
@@ -493,3 +499,5 @@ at::Tensor ROIAlign_backward_cpu(
493499
});
494500
return grad_input;
495501
}
502+
503+
} // namespace detectron2

detectron2/layers/csrc/ROIAlign/ROIAlign_cuda.cu

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ __global__ void RoIAlignBackwardFeature(
305305
} // CUDA_1D_KERNEL_LOOP
306306
} // RoIAlignBackward
307307

308+
namespace detectron2 {
309+
308310
at::Tensor ROIAlign_forward_cuda(
309311
const at::Tensor& input,
310312
const at::Tensor& rois,
@@ -416,3 +418,5 @@ at::Tensor ROIAlign_backward_cuda(
416418
AT_CUDA_CHECK(cudaGetLastError());
417419
return grad_input;
418420
}
421+
422+
} // namespace detectron2

detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ HOST_DEVICE_INLINE T rotated_boxes_intersection(
308308
return polygon_area<T>(orderedPts, num_convex);
309309
}
310310

311+
} // namespace
312+
311313
template <typename T>
312314
HOST_DEVICE_INLINE T
313315
single_box_iou_rotated(T const* const box1_raw, T const* const box2_raw) {
@@ -337,6 +339,4 @@ single_box_iou_rotated(T const* const box1_raw, T const* const box2_raw) {
337339
return iou;
338340
}
339341

340-
} // namespace
341-
342342
} // namespace detectron2

detectron2/layers/csrc/deformable/deform_conv.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#pragma once
33
#include <torch/extension.h>
44

5+
namespace detectron2 {
6+
57
#ifdef WITH_CUDA
68
int deform_conv_forward_cuda(
79
at::Tensor input,
@@ -371,3 +373,5 @@ inline void modulated_deform_conv_backward(
371373
}
372374
AT_ERROR("Not implemented on the CPU");
373375
}
376+
377+
} // namespace detectron2

detectron2/layers/csrc/deformable/deform_conv_cuda.cu

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include <cmath>
1616
#include <vector>
1717

18+
namespace detectron2 {
19+
1820
void deformable_im2col(
1921
const at::Tensor data_im,
2022
const at::Tensor data_offset,
@@ -1124,3 +1126,5 @@ void modulated_deform_conv_cuda_backward(
11241126
grad_output.size(3),
11251127
grad_output.size(4)});
11261128
}
1129+
1130+
} // namespace detectron2

0 commit comments

Comments
 (0)