Skip to content

Commit

Permalink
[Feature] torch_npu support aclnn and add op (#2997)
Browse files Browse the repository at this point in the history
  • Loading branch information
momo609 authored Feb 1, 2024
1 parent 4c01b02 commit 5494299
Show file tree
Hide file tree
Showing 16 changed files with 904 additions and 68 deletions.
4 changes: 2 additions & 2 deletions docs/en/understand_mmcv/ops.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ We implement common ops used in detection, segmentation, etc.
| BorderAlign | || | | |
| BoxIouRotated |||| ||
| BoxIouQuadri ||| | | |
| CARAFE | ||| | |
| CARAFE | ||| | |
| ChamferDistance | || | | |
| CrissCrossAttention | || | | |
| ContourExpand || | | | |
Expand Down Expand Up @@ -41,7 +41,7 @@ We implement common ops used in detection, segmentation, etc.
| PointsInBoxes ||| | | |
| PointsInPolygons | || | ||
| PSAMask |||| ||
| RotatedFeatureAlign |||| | |
| RotatedFeatureAlign |||| | |
| RoIPointPool3d | ||| | |
| RoIPool | ||| ||
| RoIAlignRotated |||| | |
Expand Down
4 changes: 2 additions & 2 deletions docs/zh_cn/understand_mmcv/ops.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MMCV 提供了检测、分割等任务中常用的算子
| BoxIouRotated |||| ||
| BoxIouQuadri ||| | | |
| CARAFE | ||| | |
| ChamferDistance | || | | |
| ChamferDistance | || | | |
| CrissCrossAttention | || | | |
| ContourExpand || | | | |
| ConvexIoU | || | | |
Expand Down Expand Up @@ -41,7 +41,7 @@ MMCV 提供了检测、分割等任务中常用的算子
| PointsInBoxes ||| | | |
| PointsInPolygons | || | | |
| PSAMask |||| ||
| RotatedFeatureAlign |||| | |
| RotatedFeatureAlign |||| | |
| RoIPointPool3d | ||| | |
| RoIPool | ||| ||
| RoIAlignRotated |||| | |
Expand Down
8 changes: 4 additions & 4 deletions mmcv/ops/chamfer_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def forward(ctx, xyz1: Tensor, xyz2: Tensor) -> Sequence[Tensor]:
xyz1 = xyz1.contiguous()
xyz2 = xyz2.contiguous()

dist1 = torch.zeros(batch_size, n).to(device)
dist2 = torch.zeros(batch_size, m).to(device)
dist1 = torch.zeros(batch_size, n).type(xyz1.dtype).to(device)
dist2 = torch.zeros(batch_size, m).type(xyz2.dtype).to(device)
idx1 = torch.zeros(batch_size, n).type(torch.IntTensor).to(device)
idx2 = torch.zeros(batch_size, m).type(torch.IntTensor).to(device)

Expand Down Expand Up @@ -81,8 +81,8 @@ def backward(ctx,
device = grad_dist1.device
grad_dist1 = grad_dist1.contiguous()
grad_dist2 = grad_dist2.contiguous()
grad_xyz1 = torch.zeros(xyz1.size()).to(device)
grad_xyz2 = torch.zeros(xyz2.size()).to(device)
grad_xyz1 = torch.zeros(xyz1.size()).type(xyz1.dtype).to(device)
grad_xyz2 = torch.zeros(xyz2.size()).type(xyz2.dtype).to(device)

ext_module.chamfer_distance_backward(xyz1, xyz2, idx1, idx2,
grad_dist1, grad_dist2, grad_xyz1,
Expand Down
1 change: 1 addition & 0 deletions mmcv/ops/csrc/common/pytorch_npu_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "pytorch_cpp_helper.hpp"
#include "pytorch_device_registry.hpp"
#include "pytorch_npu_util.hpp"

#define NPU_NAME_SPACE at_npu::native

Expand Down
Loading

0 comments on commit 5494299

Please sign in to comment.