-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add assign_score_withk adaptation code for NPU
- Loading branch information
Showing
2 changed files
with
194 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
Oops, something went wrong.