Skip to content

Commit

Permalink
add npu adaptation for assign_score_withk op (#3209)
Browse files Browse the repository at this point in the history
* test

* fix

* lint fix

* lint1
  • Loading branch information
hust17yixuan authored Dec 4, 2024
1 parent 03ce920 commit 7893e66
Show file tree
Hide file tree
Showing 2 changed files with 194 additions and 157 deletions.
23 changes: 23 additions & 0 deletions mmcv/ops/csrc/pytorch/npu/assign_score_withk_npu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "pytorch_npu_helper.hpp"

using namespace NPU_NAME_SPACE;
using namespace std;

void assign_score_withk_forward_npu(int B, int N0, int N1, int M, int K, int O,
int aggregate, const Tensor& points,
const Tensor& centers, const Tensor& scores,
const Tensor& knn_idx, Tensor& output) {
at::Tensor points_trans = points.permute({0, 3, 1, 2});
at::Tensor centers_trans = centers.permute({0, 3, 1, 2});
EXEC_NPU_CMD(aclnnAssignScoreWithk, points_trans, centers_trans, scores,
knn_idx, B, N0, N1, M, K, O, aggregate, output);
}

void assign_score_withk_forward_impl(int B, int N0, int N1, int M, int K, int O,
int aggregate, const Tensor& points,
const Tensor& centers,
const Tensor& scores,
const Tensor& knn_idx, Tensor& output);

REGISTER_NPU_IMPL(assign_score_withk_forward_impl,
assign_score_withk_forward_npu);
Loading

0 comments on commit 7893e66

Please sign in to comment.