-
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 support for Ascend devices with gather_points
- Loading branch information
Showing
4 changed files
with
88 additions
and
43 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
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
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,29 @@ | ||
#include "pytorch_npu_helper.hpp" | ||
|
||
using namespace NPU_NAME_SPACE; | ||
using namespace std; | ||
|
||
void gather_points_forward_npu(int b, int c, int n, int npoints, | ||
const Tensor points, const Tensor idx, | ||
Tensor out) { | ||
// b, c, n, and npoints do not need to be passed into gatherv2, | ||
// b, c, n, and npoints are calculated inside the operator | ||
// gatherv2 operator in ascend needs to set axis to 2, batch_dims is 1 | ||
c10::SmallVector<int64_t, N> axis = {2}; | ||
int64_t batch_dims = 1; | ||
|
||
OpCommand cmd; | ||
cmd.Name("GatherV2") | ||
.Input(points) | ||
.Input(idx) | ||
.Input(axis) | ||
.Output(out) | ||
.Attr("batch_dims", batch_dims) | ||
.Run(); | ||
} | ||
|
||
void gather_points_forward_impl(int b, int c, int n, int npoints, | ||
const Tensor points, const Tensor idx, | ||
Tensor out); | ||
|
||
REGISTER_NPU_IMPL(gather_points_forward_impl, gather_points_forward_npu); |
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