diff --git a/mmcv/ops/csrc/pytorch/npu/ms_deform_attn.cpp b/mmcv/ops/csrc/pytorch/npu/ms_deform_attn.cpp deleted file mode 100644 index 68ad24d0b41..00000000000 --- a/mmcv/ops/csrc/pytorch/npu/ms_deform_attn.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -#include "pytorch_npu_helper.hpp" - -using namespace NPU_NAME_SPACE; -using namespace std; - -Tensor ms_deform_attn_impl_backward_npu(const Tensor &value, - const Tensor &spatial_shapes, - const Tensor &level_start_index, - const Tensor &sampling_loc, - const Tensor &attn_weight, - const int im2col_step) { - EXEC_NPU_CMD(aclnnMultiScaleDeformableAttnFunction, - value, spatial_shapes, level_start_index, sampling_loc, attn_weight); -} - -void ms_deform_attn_impl_backward_npu( - const Tensor &value, const Tensor &spatial_shapes, - const Tensor &level_start_index, const Tensor &sampling_loc, - const Tensor &attn_weight, const Tensor &grad_output, Tensor &grad_value, - Tensor &grad_sampling_loc, Tensor &grad_attn_weight, - const int im2col_step) { - EXEC_NPU_CMD(aclnnMultiScaleDeformableAttnFunctionGrad, - value, spatial_shapes, level_start_index, sampling_loc, attn_weight, - grad_output, grad_value, grad_sampling_loc, grad_attn_weight); -} - -Tensor ms_deform_attn_impl_backward_npu(const Tensor &value, - const Tensor &spatial_shapes, - const Tensor &level_start_index, - const Tensor &sampling_loc, - const Tensor &attn_weight, - const int im2col_step); -REGISTER_NPU_IMPL(ms_deform_attn_impl_backward, ms_deform_attn_impl_backward_npu); - -void ms_deform_attn_impl_backward(const Tensor &value, const Tensor &spatial_shapes, - const Tensor &level_start_index, const Tensor &sampling_loc, - const Tensor &attn_weight, const Tensor &grad_output, Tensor &grad_value, - Tensor &grad_sampling_loc, Tensor &grad_attn_weight, - const int im2col_step); -REGISTER_NPU_IMPL(ms_deform_attn_impl_backward, - ms_deform_attn_impl_backward_npu); diff --git a/mmcv/ops/csrc/pytorch/npu/points_in_box_npu.cpp b/mmcv/ops/csrc/pytorch/npu/points_in_box_npu.cpp new file mode 100644 index 00000000000..63f0998c69c --- /dev/null +++ b/mmcv/ops/csrc/pytorch/npu/points_in_box_npu.cpp @@ -0,0 +1,18 @@ +#include "pytorch_npu_helper.hpp" + +using namespace NPU_NAME_SPACE; +using namespace std; + +void points_in_boxes_part_forward_impl_npu(int batch_size, int boxes_num, + int pts_num, const Tensor boxes, + const Tensor pts, + Tensor box_idx_of_points) { + c10::SmallVector output_size = {pts.size(0), pts.size(1)}; + auto boxes_trans = boxes.transpose(1, 2).contiguous(); + EXEC_NPU_CMD(aclnnPointsInBox, boxes_trans, pts, box_idx_of_points); +} +void points_in_boxes_part_forward_impl(int batch_size, int boxes_num, + int pts_num, const Tensor boxes, + const Tensor pts, + Tensor box_idx_of_points); +REGISTER_NPU_IMPL(points_in_boxes_part_forward_impl, points_in_boxes_part_forward_impl_npu);