-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Add the support of three_interpolate op for Ascend device (#…
- Loading branch information
1 parent
c0774b5
commit 94dff26
Showing
2 changed files
with
59 additions
and
11 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,29 @@ | ||
#include "pytorch_npu_helper.hpp" | ||
|
||
using namespace NPU_NAME_SPACE; | ||
using namespace std; | ||
|
||
void three_interpolate_forward_npu(int b, int c, int m, int n, | ||
const Tensor points, const Tensor idx, | ||
const Tensor weight, Tensor out) { | ||
auto point_c_trans = points.transpose(1, 2); | ||
|
||
OpCommand cmd; | ||
cmd.Name("ThreeInterpolate") | ||
.Input(point_c_trans) | ||
.Input(idx) | ||
.Input(weight) | ||
.Output(out) | ||
.Run(); | ||
|
||
auto output = out.view({b, n, c}).transpose(1, 2); | ||
auto res = NpuUtils::format_contiguous(output); | ||
out.copy_(res); | ||
} | ||
|
||
void three_interpolate_forward_impl(int b, int c, int m, int n, | ||
const Tensor points, const Tensor idx, | ||
const Tensor weight, Tensor out); | ||
|
||
REGISTER_NPU_IMPL(three_interpolate_forward_impl, | ||
three_interpolate_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