Unverified Commit 9a5685a9 authored by liuhw's avatar liuhw Committed by GitHub
Browse files

[Feature] Add the support of arf op for ascend device (#2792)

parent 107f1843
......@@ -9,7 +9,7 @@ The OpenMMLab team released MMCV v2.0.0 on April 6, 2023. In the 2.x version, it
- `mmcv.fileio` module, removed in PR [#2179](https://github.com/open-mmlab/mmcv/pull/2179). FileIO module from mmengine will be used wherever required.
- `mmcv.runner`, `mmcv.parallel`, `mmcv. engine` and `mmcv.device`, removed in PR [#2216](https://github.com/open-mmlab/mmcv/pull/2216).
- All classes in `mmcv.utils` (eg `Config` and `Registry`) and many functions, removed in PR [#2217](https://github.com/open-mmlab/mmcv/pull/2217). Only a few functions related to mmcv are reserved.
- `mmcv.onnex`, `mmcv.tensorrt` modules and related functions, removed in PR [#2225](https://github.com/open-mmlab/mmcv/pull/2225).
- `mmcv.onnx`, `mmcv.tensorrt` modules and related functions, removed in PR [#2225](https://github.com/open-mmlab/mmcv/pull/2225).
- Removed all root registrars in MMCV and registered classes or functions to the [root registrar](https://github.com/open-mmlab/mmengine/blob/main/mmengine/registry/root.py) in MMEngine.
(2) It added the [`mmcv.transforms`](https://github.com/open-mmlab/mmcv/tree/main/mmcv/transforms) data transformation module.
......@@ -27,10 +27,12 @@ The OpenMMLab team released MMCV v2.0.0 on April 6, 2023. In the 2.x version, it
```bash
# Contains ops, because the highest version of mmcv-full is less than 2.0.0, so there is no need to add version restrictions
pip install openmim
mim install mmcv-full
# do not contain ops
mmcv install "mmcv < 2.0.0"
pip install openmim
mim install "mmcv < 2.0.0"
```
</td>
......@@ -38,10 +40,11 @@ mmcv install "mmcv < 2.0.0"
```bash
# Contains ops
mim install openmim
pip install openmim
mim install mmcv
# Ops are not included, because the starting version of mmcv-lite is 2.0.0rc1, so there is no need to add version restrictions
pip install openmim
mim install mmcv-lite
```
......
......@@ -4,7 +4,7 @@ We implement common ops used in detection, segmentation, etc.
| Device | CPU | CUDA | MLU | MPS | Ascend |
| ---------------------------- | --- | ---- | --- | --- | ------ |
| ActiveRotatedFilter | √ | √ | | | |
| ActiveRotatedFilter | √ | √ | | | |
| AssignScoreWithK | | √ | | | |
| BallQuery | | √ | √ | | |
| BBoxOverlaps | | √ | √ | √ | √ |
......
......@@ -9,7 +9,7 @@ OpenMMLab 团队于 2023 年 4 月 6 日发布 MMCV [v2.0.0](https://github.com/
- `mmcv.fileio` 模块,删除于 PR [#2179](https://github.com/open-mmlab/mmcv/pull/2179)。在需要使用 FileIO 的地方使用 mmengine 中的 FileIO 模块
- `mmcv.runner``mmcv.parallel``mmcv.engine``mmcv.device`,删除于 PR [#2216](https://github.com/open-mmlab/mmcv/pull/2216)
- `mmcv.utils` 的所有类(例如 `Config``Registry`)和大部分函数,删除于 PR [#2217](https://github.com/open-mmlab/mmcv/pull/2217),只保留少数和 mmcv 相关的函数
- `mmcv.onnex``mmcv.tensorrt` 模块以及相关的函数,删除于 PR [#2225](https://github.com/open-mmlab/mmcv/pull/2225)
- `mmcv.onnx``mmcv.tensorrt` 模块以及相关的函数,删除于 PR [#2225](https://github.com/open-mmlab/mmcv/pull/2225)
- 删除 MMCV 所有的根注册器并将类或者函数注册到 MMEngine 的[根注册器](https://github.com/open-mmlab/mmengine/blob/main/mmengine/registry/root.py)
(2)新增了 [`mmcv.transforms`](https://github.com/open-mmlab/mmcv/tree/main/mmcv/transforms) 数据变换模块
......@@ -27,10 +27,12 @@ OpenMMLab 团队于 2023 年 4 月 6 日发布 MMCV [v2.0.0](https://github.com/
```bash
# 包含算子,因为 mmcv-full 的最高版本小于 2.0.0,所以无需加版本限制
pip install openmim
mim install mmcv-full
# 不包含算子
mmcv install "mmcv < 2.0.0"
pip install openmim
mim install "mmcv < 2.0.0"
```
</td>
......@@ -38,11 +40,12 @@ mmcv install "mmcv < 2.0.0"
```bash
# 包含算子
mim install openmim
pip install openmim
mim install mmcv
# 不包含算子,因为 mmcv-lite 的起始版本为 2.0.0,所以无需加版本限制
pip install mmcv-lite
pip install openmim
mim install mmcv-lite
```
</td>
......
......@@ -4,7 +4,7 @@ MMCV 提供了检测、分割等任务中常用的算子
| Device | CPU | CUDA | MLU | MPS | Ascend |
| ---------------------------- | --- | ---- | --- | --- | ------ |
| ActiveRotatedFilter | √ | √ | | | |
| ActiveRotatedFilter | √ | √ | | | |
| AssignScoreWithK | | √ | | | |
| BallQuery | | √ | √ | | |
| BBoxOverlaps | | √ | √ | √ | √ |
......
#include "pytorch_npu_helper.hpp"
using namespace NPU_NAME_SPACE;
using namespace std;
void active_rotated_filter_forward_impl(const Tensor input,
const Tensor indices, Tensor output);
void active_rotated_filter_backward_impl(const Tensor grad_out,
const Tensor indices, Tensor grad_in);
void active_rotated_filter_forward_npu(const Tensor input, const Tensor indices,
Tensor output) {
OpCommand cmd;
cmd.Name("ActiveRotatedFilter")
.Input(input)
.Input(indices)
.Output(output)
.Run();
}
void active_rotated_filter_backward_npu(const Tensor grad_out,
const Tensor indices, Tensor grad_in) {
OpCommand cmd;
cmd.Name("ActiveRotatedFilterGrad")
.Input(grad_out)
.Input(indices)
.Output(grad_in)
.Run();
}
REGISTER_NPU_IMPL(active_rotated_filter_forward_impl,
active_rotated_filter_forward_npu);
REGISTER_NPU_IMPL(active_rotated_filter_backward_impl,
active_rotated_filter_backward_npu);
......@@ -4,6 +4,7 @@ import pytest
import torch
from mmcv.ops import active_rotated_filter
from mmcv.utils import IS_CUDA_AVAILABLE, IS_NPU_AVAILABLE
np_feature = np.array([[[[[-1.4934e-01, 1.1341e+00, -1.6241e-01],
[-1.0986e+00, -1.1463e+00, -1.3176e+00],
......@@ -245,7 +246,11 @@ expected_grad = np.array([[[[[8., 8., 8.], [8., 8., 8.], [8., 8., 8.]]]],
pytest.param(
'cuda',
marks=pytest.mark.skipif(
not torch.cuda.is_available(), reason='requires CUDA support')),
not IS_CUDA_AVAILABLE, reason='requires CUDA support')),
pytest.param(
'npu',
marks=pytest.mark.skipif(
not IS_NPU_AVAILABLE, reason='requires NPU support'))
])
def test_active_rotated_filter(device):
feature = torch.tensor(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment