Skip to content

Commit

Permalink
add op
Browse files Browse the repository at this point in the history
  • Loading branch information
momo609 committed Nov 30, 2023
1 parent a4632ba commit 93f8433
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions mmcv/ops/csrc/pytorch/npu/chamfer_distance_npu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

#include "pytorch_npu_helper.hpp"

using namespace NPU_NAME_SPACE;
using namespace std;

void chamfer_distance_forward_npu(Tensor XYZ1, Tensor XYZ2, Tensor dist1,
Tensor dist2, Tensor idx1, Tensor idx2) {
at::Tensor xyz1 = at::ones_like(XYZ1);
at::Tensor xyz2 = at::ones_like(XYZ2);
xyz1 = XYZ1.transpose(1,2);
xyz2 = XYZ2.transpose(1,2);
OpCommand cmd;
cmd.Name("ChamferDistance")
.Input(xyz1)
.Input(xyz2)
.Output(dist1)
.Output(dist2)
.Output(idx1)
.Output(idx2)
.Run();
}

void chamfer_distance_forward_impl(Tensor XYZ1, Tensor XYZ2, Tensor dist1,
Tensor dist2, Tensor idx1, Tensor idx2);
REGISTER_NPU_IMPL(chamfer_distance_forward_impl,
chamfer_distance_forward_npu);

0 comments on commit 93f8433

Please sign in to comment.