From c25ba6dce2c16357685b7113bd7535434e17a6bd Mon Sep 17 00:00:00 2001 From: sunxing <346736790@qq.com> Date: Tue, 22 Mar 2022 11:49:51 +0800 Subject: [PATCH] =?UTF-8?q?a=E7=AE=97=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/test_network_ops/test___and__.py | 2 +- test/test_network_ops/test___ior__.py | 2 +- test/test_network_ops/test___or__.py | 2 +- test/test_network_ops/test__iRshift__.py | 2 +- test/test_network_ops/test__ilshift__.py | 2 +- test/test_network_ops/test__rshift__.py | 2 +- test/test_network_ops/test__svd_helper.py | 2 +- test/test_network_ops/test_abs.py | 2 +- test/test_network_ops/test_adaptive_avg_pool1d.py | 2 +- test/test_network_ops/test_adaptive_avg_pool2d_backward.py | 2 +- test/test_network_ops/test_adaptive_avg_pool3d.py | 2 +- test/test_network_ops/test_adaptive_avg_pool3d_backward.py | 2 +- test/test_network_ops/test_adaptive_max_pool2d.py | 2 +- test/test_network_ops/test_adaptive_max_pool2d_backward.py | 2 +- test/test_network_ops/test_add.py | 2 +- test/test_network_ops/test_addbmm.py | 2 +- test/test_network_ops/test_addmm.py | 2 +- test/test_network_ops/test_addmv.py | 3 +-- test/test_network_ops/test_addr.py | 2 +- test/test_network_ops/test_affine_grid_generator.py | 2 +- test/test_network_ops/test_affine_grid_generator_backward.py | 2 +- test/test_network_ops/test_all.py | 2 +- test/test_network_ops/test_anchorresponseflags.py | 2 +- test/test_network_ops/test_any.py | 2 +- test/test_network_ops/test_arange.py | 2 +- test/test_network_ops/test_argmax.py | 2 +- test/test_network_ops/test_argmin.py | 2 +- test/test_network_ops/test_argsort.py | 2 +- test/test_network_ops/test_asin.py | 2 +- test/test_network_ops/test_atan.py | 2 +- test/test_network_ops/test_atan2.py | 2 +- test/test_network_ops/test_avg_pool2d.py | 2 +- test/test_network_ops/test_avg_pool2d_backward.py | 2 +- test/test_network_ops/test_avg_pool3d.py | 4 +--- test/test_network_ops/test_avg_pool3d_backward.py | 2 +- 35 files changed, 35 insertions(+), 38 deletions(-) diff --git a/test/test_network_ops/test___and__.py b/test/test_network_ops/test___and__.py index 03017da320..f65ebd2cd0 100644 --- a/test/test_network_ops/test___and__.py +++ b/test/test_network_ops/test___and__.py @@ -14,8 +14,8 @@ # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test___ior__.py b/test/test_network_ops/test___ior__.py index 363aa108a8..ae5488022f 100644 --- a/test/test_network_ops/test___ior__.py +++ b/test/test_network_ops/test___ior__.py @@ -13,8 +13,8 @@ # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests diff --git a/test/test_network_ops/test___or__.py b/test/test_network_ops/test___or__.py index 74bd6c8d27..496c923852 100644 --- a/test/test_network_ops/test___or__.py +++ b/test/test_network_ops/test___or__.py @@ -15,8 +15,8 @@ import copy import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test__iRshift__.py b/test/test_network_ops/test__iRshift__.py index aae06cf435..0fa5ddc870 100644 --- a/test/test_network_ops/test__iRshift__.py +++ b/test/test_network_ops/test__iRshift__.py @@ -15,8 +15,8 @@ # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test__ilshift__.py b/test/test_network_ops/test__ilshift__.py index db2450246c..18f7906e27 100644 --- a/test/test_network_ops/test__ilshift__.py +++ b/test/test_network_ops/test__ilshift__.py @@ -15,8 +15,8 @@ # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test__rshift__.py b/test/test_network_ops/test__rshift__.py index 72409eb466..44e85af201 100644 --- a/test/test_network_ops/test__rshift__.py +++ b/test/test_network_ops/test__rshift__.py @@ -15,8 +15,8 @@ # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test__svd_helper.py b/test/test_network_ops/test__svd_helper.py index da3b0e4a5a..9098310ec5 100644 --- a/test/test_network_ops/test__svd_helper.py +++ b/test/test_network_ops/test__svd_helper.py @@ -15,8 +15,8 @@ # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_abs.py b/test/test_network_ops/test_abs.py index e1e4de92c0..28db57266e 100644 --- a/test/test_network_ops/test_abs.py +++ b/test/test_network_ops/test_abs.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_adaptive_avg_pool1d.py b/test/test_network_ops/test_adaptive_avg_pool1d.py index af129c3e5f..7390fcf2a5 100644 --- a/test/test_network_ops/test_adaptive_avg_pool1d.py +++ b/test/test_network_ops/test_adaptive_avg_pool1d.py @@ -13,9 +13,9 @@ # limitations under the License. import torch -import torch_npu import torch.nn as nn import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_adaptive_avg_pool2d_backward.py b/test/test_network_ops/test_adaptive_avg_pool2d_backward.py index 7037973c85..0f9a67e673 100644 --- a/test/test_network_ops/test_adaptive_avg_pool2d_backward.py +++ b/test/test_network_ops/test_adaptive_avg_pool2d_backward.py @@ -13,9 +13,9 @@ # limitations under the License. import torch -import torch_npu import numpy as np from torch.nn import functional as F +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests diff --git a/test/test_network_ops/test_adaptive_avg_pool3d.py b/test/test_network_ops/test_adaptive_avg_pool3d.py index 83f39c5c18..e7c9eac1c3 100644 --- a/test/test_network_ops/test_adaptive_avg_pool3d.py +++ b/test/test_network_ops/test_adaptive_avg_pool3d.py @@ -13,9 +13,9 @@ # limitations under the License. import torch -import torch_npu import torch.nn as nn import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_adaptive_avg_pool3d_backward.py b/test/test_network_ops/test_adaptive_avg_pool3d_backward.py index e5d3fde9f3..26bc5ad21c 100644 --- a/test/test_network_ops/test_adaptive_avg_pool3d_backward.py +++ b/test/test_network_ops/test_adaptive_avg_pool3d_backward.py @@ -13,9 +13,9 @@ # limitations under the License. import torch -import torch_npu import numpy as np from torch.nn import functional as F +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_adaptive_max_pool2d.py b/test/test_network_ops/test_adaptive_max_pool2d.py index 0cfe2c8417..1d4b4180cd 100644 --- a/test/test_network_ops/test_adaptive_max_pool2d.py +++ b/test/test_network_ops/test_adaptive_max_pool2d.py @@ -13,8 +13,8 @@ # limitations under the License. import torch.nn as nn -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_adaptive_max_pool2d_backward.py b/test/test_network_ops/test_adaptive_max_pool2d_backward.py index 8fb62a32d5..11f2564cee 100644 --- a/test/test_network_ops/test_adaptive_max_pool2d_backward.py +++ b/test/test_network_ops/test_adaptive_max_pool2d_backward.py @@ -13,9 +13,9 @@ # limitations under the License. import torch -import torch_npu import torch.nn as nn import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_add.py b/test/test_network_ops/test_add.py index bc5c9a9c99..8700e39e62 100644 --- a/test/test_network_ops/test_add.py +++ b/test/test_network_ops/test_add.py @@ -13,8 +13,8 @@ # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_addbmm.py b/test/test_network_ops/test_addbmm.py index 7b3a380146..2e98155470 100644 --- a/test/test_network_ops/test_addbmm.py +++ b/test/test_network_ops/test_addbmm.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_addmm.py b/test/test_network_ops/test_addmm.py index 58db41361a..06a849b74e 100644 --- a/test/test_network_ops/test_addmm.py +++ b/test/test_network_ops/test_addmm.py @@ -13,8 +13,8 @@ # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_addmv.py b/test/test_network_ops/test_addmv.py index b59052a87c..b0ae5f62b1 100644 --- a/test/test_network_ops/test_addmv.py +++ b/test/test_network_ops/test_addmv.py @@ -13,8 +13,8 @@ # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor @@ -22,7 +22,6 @@ from torch_npu.testing.common_utils import create_common_tensor class TestAddmv(TestCase): def cpu_op_exec(self, a, b, c, alpha, beta): - '''output = alpha * a @ b + beta * c''' output = torch.addmv(c, a, b, alpha=alpha, beta=beta) output = output.numpy() return output diff --git a/test/test_network_ops/test_addr.py b/test/test_network_ops/test_addr.py index 3d37459509..d1794d3f9a 100644 --- a/test/test_network_ops/test_addr.py +++ b/test/test_network_ops/test_addr.py @@ -13,8 +13,8 @@ # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_affine_grid_generator.py b/test/test_network_ops/test_affine_grid_generator.py index 1c62d975d7..6efa4604f8 100644 --- a/test/test_network_ops/test_affine_grid_generator.py +++ b/test/test_network_ops/test_affine_grid_generator.py @@ -15,9 +15,9 @@ # limitations under the License. import torch -import torch_npu import numpy as np from torch.nn import functional as F +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests diff --git a/test/test_network_ops/test_affine_grid_generator_backward.py b/test/test_network_ops/test_affine_grid_generator_backward.py index e13250aaf0..1f67e08a10 100644 --- a/test/test_network_ops/test_affine_grid_generator_backward.py +++ b/test/test_network_ops/test_affine_grid_generator_backward.py @@ -13,9 +13,9 @@ # limitations under the License. import torch -import torch_npu import numpy as np from torch.nn import functional as F +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_all.py b/test/test_network_ops/test_all.py index df40ae4545..33bcd3d574 100644 --- a/test/test_network_ops/test_all.py +++ b/test/test_network_ops/test_all.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests diff --git a/test/test_network_ops/test_anchorresponseflags.py b/test/test_network_ops/test_anchorresponseflags.py index 57847f467e..8617af1335 100644 --- a/test/test_network_ops/test_anchorresponseflags.py +++ b/test/test_network_ops/test_anchorresponseflags.py @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. import torch -import torch_npu import numpy as np from torch.nn import functional as F +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_any.py b/test/test_network_ops/test_any.py index 6a2a34a196..08d1a7ad03 100644 --- a/test/test_network_ops/test_any.py +++ b/test/test_network_ops/test_any.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests diff --git a/test/test_network_ops/test_arange.py b/test/test_network_ops/test_arange.py index c4aa1a13e5..87f33cf018 100644 --- a/test/test_network_ops/test_arange.py +++ b/test/test_network_ops/test_arange.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_argmax.py b/test/test_network_ops/test_argmax.py index 5e0007727a..aa88eba673 100644 --- a/test/test_network_ops/test_argmax.py +++ b/test/test_network_ops/test_argmax.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_argmin.py b/test/test_network_ops/test_argmin.py index d63c756e0c..0fd639981d 100644 --- a/test/test_network_ops/test_argmin.py +++ b/test/test_network_ops/test_argmin.py @@ -15,8 +15,8 @@ # coding: utf-8 import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_argsort.py b/test/test_network_ops/test_argsort.py index e0fcfed5f8..fae2234d97 100644 --- a/test/test_network_ops/test_argsort.py +++ b/test/test_network_ops/test_argsort.py @@ -14,8 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_asin.py b/test/test_network_ops/test_asin.py index 45d014c759..7026cf0410 100644 --- a/test/test_network_ops/test_asin.py +++ b/test/test_network_ops/test_asin.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_atan.py b/test/test_network_ops/test_atan.py index ad42891622..43d887e17a 100644 --- a/test/test_network_ops/test_atan.py +++ b/test/test_network_ops/test_atan.py @@ -14,8 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_atan2.py b/test/test_network_ops/test_atan2.py index bded83715f..161d53db67 100644 --- a/test/test_network_ops/test_atan2.py +++ b/test/test_network_ops/test_atan2.py @@ -13,8 +13,8 @@ # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_avg_pool2d.py b/test/test_network_ops/test_avg_pool2d.py index 4d1c4e432b..59d063db67 100644 --- a/test/test_network_ops/test_avg_pool2d.py +++ b/test/test_network_ops/test_avg_pool2d.py @@ -13,9 +13,9 @@ # limitations under the License. import torch -import torch_npu import torch.nn as nn import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_avg_pool2d_backward.py b/test/test_network_ops/test_avg_pool2d_backward.py index fb89146df2..556ac65688 100644 --- a/test/test_network_ops/test_avg_pool2d_backward.py +++ b/test/test_network_ops/test_avg_pool2d_backward.py @@ -13,9 +13,9 @@ # limitations under the License. import torch -import torch_npu import torch.nn as nn import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor diff --git a/test/test_network_ops/test_avg_pool3d.py b/test/test_network_ops/test_avg_pool3d.py index dd8e3188f4..fe16fc3e17 100644 --- a/test/test_network_ops/test_avg_pool3d.py +++ b/test/test_network_ops/test_avg_pool3d.py @@ -15,8 +15,8 @@ # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor @@ -40,7 +40,6 @@ class TestAvgPool3D(TestCase): return output_data def test_avg_pool_3d_fp32(self, device="npu"): - # shape_format:[[dtype, (input_shape)], kernel_size, stride] shape_format = [ [[np.float32, -1, (20, 16, 50, 44, 31)], (3, 2, 2), (2, 1, 2)], [[np.float32, -1, (2, 1, 4, 4, 4)], 3, 2], @@ -55,7 +54,6 @@ class TestAvgPool3D(TestCase): self.assertRtolEqual(cpu_output, npu_output.cpu(), 1.e-3) def test_avg_pool_3d_fp16(self, device="npu"): - # shape_format:[[dtype, (input_shape)], kernel_size, stride] shape_format = [ [[np.float16, -1, (20, 16, 50, 44, 31)], (3, 2, 2), (2, 1, 2)], [[np.float16, -1, (2, 1, 4, 4, 4)], 3, 2], diff --git a/test/test_network_ops/test_avg_pool3d_backward.py b/test/test_network_ops/test_avg_pool3d_backward.py index e86ecc7d2b..4e399f6fe8 100644 --- a/test/test_network_ops/test_avg_pool3d_backward.py +++ b/test/test_network_ops/test_avg_pool3d_backward.py @@ -15,8 +15,8 @@ # limitations under the License. import torch -import torch_npu import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor -- Gitee