From 4d5fecab0d01ff9209ea19543ce12a6b5d5d51d7 Mon Sep 17 00:00:00 2001 From: dflhw <595869386@qq.com> Date: Tue, 9 May 2023 09:56:51 +0800 Subject: [PATCH] add utest --- docs/en/compatibility.md | 2 +- docs/zh_cn/compatibility.md | 2 +- ...ve_rotated_filter.cpp => active_rotated_filter_npu.cpp} | 0 tests/test_ops/test_active_rotated_filter.py | 7 ++++++- 4 files changed, 8 insertions(+), 3 deletions(-) rename mmcv/ops/csrc/pytorch/npu/{active_rotated_filter.cpp => active_rotated_filter_npu.cpp} (100%) diff --git a/docs/en/compatibility.md b/docs/en/compatibility.md index fc8516c4923..e00d749d19d 100644 --- a/docs/en/compatibility.md +++ b/docs/en/compatibility.md @@ -9,7 +9,7 @@ At the same time, MMCV released [2.x](https://github.com/open-mmlab/mmcv/tree/2. - `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). (2) It added the [`mmcv.transforms`](https://github.com/open-mmlab/mmcv/tree/2.x/mmcv/transforms) data transformation module. diff --git a/docs/zh_cn/compatibility.md b/docs/zh_cn/compatibility.md index 9f8bbfa9319..f2985976edd 100644 --- a/docs/zh_cn/compatibility.md +++ b/docs/zh_cn/compatibility.md @@ -9,7 +9,7 @@ OpenMMLab 团队于 2022 年 9 月 1 日在世界人工智能大会发布了新 - `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) (2)新增了 [`mmcv.transforms`](https://github.com/open-mmlab/mmcv/tree/2.x/mmcv/transforms) 数据变换模块 diff --git a/mmcv/ops/csrc/pytorch/npu/active_rotated_filter.cpp b/mmcv/ops/csrc/pytorch/npu/active_rotated_filter_npu.cpp similarity index 100% rename from mmcv/ops/csrc/pytorch/npu/active_rotated_filter.cpp rename to mmcv/ops/csrc/pytorch/npu/active_rotated_filter_npu.cpp diff --git a/tests/test_ops/test_active_rotated_filter.py b/tests/test_ops/test_active_rotated_filter.py index 30ea59c5c62..c2f7295abde 100644 --- a/tests/test_ops/test_active_rotated_filter.py +++ b/tests/test_ops/test_active_rotated_filter.py @@ -4,6 +4,7 @@ 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 @@ 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(