diff --git a/test/test_network_ops/test_default.py b/test/test_network_ops/test_default.py index f359925b947a6646c19ff128c281290c1ea303bb..365b78a0d77138f4e849cfc65b38c3a379f17a98 100644 --- a/test/test_network_ops/test_default.py +++ b/test/test_network_ops/test_default.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_deformable_conv2d.py b/test/test_network_ops/test_deformable_conv2d.py index 21d80a10902c0f65c2e64debee5795dce6251934..d0de86f4887aa089cf9974172e1a6fdf83cbd3b3 100644 --- a/test/test_network_ops/test_deformable_conv2d.py +++ b/test/test_network_ops/test_deformable_conv2d.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_deformable_conv2d_backward.py b/test/test_network_ops/test_deformable_conv2d_backward.py index 493bcdb5a01c2a37a74b365e9ec708adaaa64505..8b49bdf219a5ae7d43ba0f273663b95825a60aef 100644 --- a/test/test_network_ops/test_deformable_conv2d_backward.py +++ b/test/test_network_ops/test_deformable_conv2d_backward.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_diag.py b/test/test_network_ops/test_diag.py index 521d5fc44029709534e300d7c2cea423b0f70a1e..9fd4c7e74179c854f2336efbe1853a2ea4256bb0 100644 --- a/test/test_network_ops/test_diag.py +++ b/test/test_network_ops/test_diag.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_div.py b/test/test_network_ops/test_div.py index ae1ba2685d81794d1980c8b69d596022fe6a3551..c888b29f321ce7894274302864002a89fa1df3d8 100644 --- a/test/test_network_ops/test_div.py +++ b/test/test_network_ops/test_div.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +import unittest import torch -import torch_npu import numpy as np -import unittest +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests from torch_npu.testing.common_utils import create_common_tensor, test_2args_broadcast, create_dtype_tensor, UT_FAST_MODE @@ -122,7 +122,8 @@ class TestDiv(TestCase): for item in shape_format: cpu_input1, npu_input1 = create_common_tensor(item, 1, 100) cpu_input2, npu_input2 = create_common_tensor(item, 1, 100) - cpu_output, npu_output = self.get_outputs_chk([cpu_input1, cpu_input2], [npu_input1, npu_input2], torch.float) + cpu_output, npu_output = self.get_outputs_chk([cpu_input1, cpu_input2], + [npu_input1, npu_input2], torch.float) self.assertRtolEqual(cpu_output, npu_output) diff --git a/test/test_network_ops/test_dot.py b/test/test_network_ops/test_dot.py index eab188d62d63f18cfa0ea0163a21c0832a8d20b4..70ad43cf52604ccd7d49dccc751c1ba58724ebf3 100644 --- a/test/test_network_ops/test_dot.py +++ b/test/test_network_ops/test_dot.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_dropout.py b/test/test_network_ops/test_dropout.py index 4595ae9bf274300dbcedde8907c6097cefb1d0bc..00d245b1eed30cd5d7bffc6a915d405154130c22 100644 --- a/test/test_network_ops/test_dropout.py +++ b/test/test_network_ops/test_dropout.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_dropout_backward.py b/test/test_network_ops/test_dropout_backward.py index b2deb21bcd9fbc2077882d7c79c71d3dd84aabd7..bb2092833a819ee5b42cf3b9b6e61ad3baf30456 100644 --- a/test/test_network_ops/test_dropout_backward.py +++ b/test/test_network_ops/test_dropout_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_dtype_cast.py b/test/test_network_ops/test_dtype_cast.py index 5eb221ea62128c8db42ffd19a0d9104fba37e22b..c810d6985d06661dfc940dc7a3be736bdd7f32be 100644 --- a/test/test_network_ops/test_dtype_cast.py +++ b/test/test_network_ops/test_dtype_cast.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_elu.py b/test/test_network_ops/test_elu.py index 514a4e843521ce4340727f3704096c3c21da2665..96c4b9c10bdcbfa84e99b80cb14ca7ba0e5c6255 100644 --- a/test/test_network_ops/test_elu.py +++ b/test/test_network_ops/test_elu.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_elu_backward.py b/test/test_network_ops/test_elu_backward.py index 5d8feaba0efc6f423b34b4bb02072e65474915f8..2eda909a4d99c16a9785c78e0414ff4ff8d09ea0 100644 --- a/test/test_network_ops/test_elu_backward.py +++ b/test/test_network_ops/test_elu_backward.py @@ -14,9 +14,9 @@ # limitations under the License. import torch -import torch_npu import numpy as np import torch.nn as nn +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_embedding.py b/test/test_network_ops/test_embedding.py index 4243bfb6357fcd5e784cdbdb78cbad87dfc29b42..aa5c15ff10bc7e73971704b00b6e93b479041a26 100644 --- a/test/test_network_ops/test_embedding.py +++ b/test/test_network_ops/test_embedding.py @@ -13,9 +13,9 @@ # limitations under the License. import torch -import torch_npu import numpy as np import torch.nn.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_embedding_backward.py b/test/test_network_ops/test_embedding_backward.py index 8dd9e815c6f90891791db1efd9af691865acdc63..5445d8ea69989b4332a97d9ada97c34d755bf02a 100644 --- a/test/test_network_ops/test_embedding_backward.py +++ b/test/test_network_ops/test_embedding_backward.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 torch.nn.functional as F 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_embedding_bag.py b/test/test_network_ops/test_embedding_bag.py index 0a86761e65f73a11b7a3ac96ff9860ed01c9aa49..c961debfe0b5e3054beadd30e6cb551b31adc71a 100644 --- a/test/test_network_ops/test_embedding_bag.py +++ b/test/test_network_ops/test_embedding_bag.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 import torch.nn.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_embedding_bag_backward.py b/test/test_network_ops/test_embedding_bag_backward.py index b1c0beb6b7e17b7b2a96bb90f944ea0778204fa2..f8003f6531a3476b37391197155f8cf3fe22e821 100644 --- a/test/test_network_ops/test_embedding_bag_backward.py +++ b/test/test_network_ops/test_embedding_bag_backward.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 import torch.nn.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_embedding_renorm.py b/test/test_network_ops/test_embedding_renorm.py index 194b1578e75ef08f1c60c9e3043c6881ae085ac2..7b3762e1948230aeab26be82d439d411c845974e 100644 --- a/test/test_network_ops/test_embedding_renorm.py +++ b/test/test_network_ops/test_embedding_renorm.py @@ -13,8 +13,8 @@ # limitations under the License. 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_embeddingdensebackward.py b/test/test_network_ops/test_embeddingdensebackward.py index e7d5fa767ec1a71935e8d806e8a4b3fc4d286cdd..ec4119c8e9dbd4e178731eca91f4f76837e2ea75 100644 --- a/test/test_network_ops/test_embeddingdensebackward.py +++ b/test/test_network_ops/test_embeddingdensebackward.py @@ -13,9 +13,9 @@ # limitations under the License. import torch -import torch_npu import numpy as np import torch.nn.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_eq.py b/test/test_network_ops/test_eq.py index 42932a7d5c43099a28704f33c69883403a34f2a3..d18eca235c9c69b58f0689ed6939b97b7d41a5c6 100644 --- a/test/test_network_ops/test_eq.py +++ b/test/test_network_ops/test_eq.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_equal.py b/test/test_network_ops/test_equal.py index 42dbea43d600ba1647ab6f747df91fd04ea97adc..26ce36791d6a4b072315dc2d854894eca8dcd4d8 100644 --- a/test/test_network_ops/test_equal.py +++ b/test/test_network_ops/test_equal.py @@ -16,8 +16,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_erf.py b/test/test_network_ops/test_erf.py index 8501eebf566c56a0a8ed9a70ed098d431a888d93..45db8f54329552e0d41bf162264193810f35f406 100644 --- a/test/test_network_ops/test_erf.py +++ b/test/test_network_ops/test_erf.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_erfc.py b/test/test_network_ops/test_erfc.py index 9d218d9156ee16c2e29afc957725e2561a7d1881..d6cba98171871c1c582956e3c2480c9669acf64e 100644 --- a/test/test_network_ops/test_erfc.py +++ b/test/test_network_ops/test_erfc.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_erfinv.py b/test/test_network_ops/test_erfinv.py index d5f42bed15816bdb59ddf882f08335e2ae828c6b..4e7b92dfd8f46622c484fef331c9cf98b08d3afc 100644 --- a/test/test_network_ops/test_erfinv.py +++ b/test/test_network_ops/test_erfinv.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_exp.py b/test/test_network_ops/test_exp.py index f6b533f36d0acfd4502ae216ada48d6ae5ce4ade..7917c39ed827a567fee06a607c2295c92394e79e 100644 --- a/test/test_network_ops/test_exp.py +++ b/test/test_network_ops/test_exp.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_expm1.py b/test/test_network_ops/test_expm1.py index cf68bae2e4793945dd08db86315cf2a3ef8577b5..a5c309ae9681f367f9f9f55e91f68e315b9fb3c7 100644 --- a/test/test_network_ops/test_expm1.py +++ b/test/test_network_ops/test_expm1.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_eye.py b/test/test_network_ops/test_eye.py index e970dd8dde0418d01d16329a58c3f154b744f562..c23c72869f760cdbfc81c383dda083fd44273d56 100644 --- a/test/test_network_ops/test_eye.py +++ b/test/test_network_ops/test_eye.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_fast_gelu.py b/test/test_network_ops/test_fast_gelu.py index c8023da6efbefc6b3ced6bfe76738ec247a6fc03..55621e7814f946e7167206336051a64d979c2135 100644 --- a/test/test_network_ops/test_fast_gelu.py +++ b/test/test_network_ops/test_fast_gelu.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_fast_gelu_backward.py b/test/test_network_ops/test_fast_gelu_backward.py index 51522f2ac300b5237bc45bfe9af2cf3ddf8b289b..5814ef9b7a94084bb41f518e75038539870a8f30 100644 --- a/test/test_network_ops/test_fast_gelu_backward.py +++ b/test/test_network_ops/test_fast_gelu_backward.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_flip.py b/test/test_network_ops/test_flip.py index b368f362b4a9ab537c6ce1bb935f26cc4ed76b6f..86f44aff822ad8f4dfd291128de17eabdf597fdc 100644 --- a/test/test_network_ops/test_flip.py +++ b/test/test_network_ops/test_flip.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_floor.py b/test/test_network_ops/test_floor.py index 800e5fca2df8c711b4f70f91773eaf44c7f73afc..bc5a881f1cb5e575101aba268464fc8e209b3984 100644 --- a/test/test_network_ops/test_floor.py +++ b/test/test_network_ops/test_floor.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_floordivide.py b/test/test_network_ops/test_floordivide.py index 1553907ad96ad67de159e35c448d76b52df16997..e0369c8b1fff6b1834a5126047081583e0a5b9c8 100644 --- a/test/test_network_ops/test_floordivide.py +++ b/test/test_network_ops/test_floordivide.py @@ -14,8 +14,8 @@ # limitations under the License. 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_fmod.py b/test/test_network_ops/test_fmod.py index 83008260ce0db6a8b593d695473f4791156e3b37..861ba26dae4da0a7adba5c864175464f2af04d31 100644 --- a/test/test_network_ops/test_fmod.py +++ b/test/test_network_ops/test_fmod.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_format_cast.py b/test/test_network_ops/test_format_cast.py index 007129f4c30499adccd265a9cbc98c7b3047bcca..9ef8934f42d43dc14e80514339246b5df45415b8 100644 --- a/test/test_network_ops/test_format_cast.py +++ b/test/test_network_ops/test_format_cast.py @@ -14,8 +14,8 @@ import sys 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_frac.py b/test/test_network_ops/test_frac.py index 869e9c1279087339482bc6ff83fb770be12a5c07..142bd19879ece8ff9576e964d1003add6a198e61 100644 --- a/test/test_network_ops/test_frac.py +++ b/test/test_network_ops/test_frac.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_full.py b/test/test_network_ops/test_full.py index a02613b5d88b22643167c3c0f01620918ea936a9..914eaa13072619b0cec8d78dfc6be816ee9813b9 100644 --- a/test/test_network_ops/test_full.py +++ b/test/test_network_ops/test_full.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_gather.py b/test/test_network_ops/test_gather.py index ee836b037ba95116bd033729b1a226deb2ce7209..b841629b2de0b4fb83da23aa154c76626e4c5096 100644 --- a/test/test_network_ops/test_gather.py +++ b/test/test_network_ops/test_gather.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_ge.py b/test/test_network_ops/test_ge.py index 487838c4945207aed3cc3979c30138f895283b78..7b5d1862c6fd6d29300c9581d85d4af4ca7ce00c 100644 --- a/test/test_network_ops/test_ge.py +++ b/test/test_network_ops/test_ge.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_gelu.py b/test/test_network_ops/test_gelu.py index 1820cbb90675e2873be7833a5fc14c32ab1bc44c..aa99e059c82c03a0558cc60ee2bd69f1291bb40b 100644 --- a/test/test_network_ops/test_gelu.py +++ b/test/test_network_ops/test_gelu.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 diff --git a/test/test_network_ops/test_gelu_backward.py b/test/test_network_ops/test_gelu_backward.py index 910c140613a4420e6479ca9daff82f42f0100b7a..63bebc9bbddc434e79f2bea351c621e25bb4b15d 100644 --- a/test/test_network_ops/test_gelu_backward.py +++ b/test/test_network_ops/test_gelu_backward.py @@ -13,8 +13,8 @@ # limitations under the License. import copy 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_ger.py b/test/test_network_ops/test_ger.py index ae3a67d12694b5592cb52dd72d9991c56fa170f6..b78265fe0cdc328fefe13ba087e740fae99e1ee3 100644 --- a/test/test_network_ops/test_ger.py +++ b/test/test_network_ops/test_ger.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_glu.py b/test/test_network_ops/test_glu.py index 6ec9ebf3fdf922937d8653040d31dc3a335b87b2..457ddabba3231eda288977be9528eaf20b142ecf 100644 --- a/test/test_network_ops/test_glu.py +++ b/test/test_network_ops/test_glu.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_glugrad.py b/test/test_network_ops/test_glugrad.py index 0a1b7f33111db1b16baee75e571b92a427f2309d..bb61ad19b8a8794c91b9564eb087d1349a4faf6a 100644 --- a/test/test_network_ops/test_glugrad.py +++ b/test/test_network_ops/test_glugrad.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_grid_sampler.py b/test/test_network_ops/test_grid_sampler.py index 4296cf46a8006c8d491065c5bb327f8b35f80603..ee57ade9cbfec8a7b8b4c7d70a4f9607d0ac46b8 100644 --- a/test/test_network_ops/test_grid_sampler.py +++ b/test/test_network_ops/test_grid_sampler.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_grid_sampler_2d.py b/test/test_network_ops/test_grid_sampler_2d.py index 9ea285d514a0c4a80c652d0c28d915cac455538b..803cd05e81de21d7636e8c26ba2e97f2e0a811cc 100644 --- a/test/test_network_ops/test_grid_sampler_2d.py +++ b/test/test_network_ops/test_grid_sampler_2d.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_grid_sampler_2d_backward.py b/test/test_network_ops/test_grid_sampler_2d_backward.py index 9b5cc3783f40f59511ff03ae16a29dda114c4a9b..6ce8763b367027b0e07dc78d94625fbf0fe863b0 100644 --- a/test/test_network_ops/test_grid_sampler_2d_backward.py +++ b/test/test_network_ops/test_grid_sampler_2d_backward.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_grid_sampler_3d.py b/test/test_network_ops/test_grid_sampler_3d.py index f64df15f0967cb7be0e1649f745b542b11558cd8..c8f21940cbbb10bc8e951fc79788b997c7e5a61d 100644 --- a/test/test_network_ops/test_grid_sampler_3d.py +++ b/test/test_network_ops/test_grid_sampler_3d.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_grid_sampler_3d_backward.py b/test/test_network_ops/test_grid_sampler_3d_backward.py index e97f8957641683d86500cbaff38f9b610fe212bf..fb4b875e1370ba419a97b7a35f72a92191f987c0 100644 --- a/test/test_network_ops/test_grid_sampler_3d_backward.py +++ b/test/test_network_ops/test_grid_sampler_3d_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 diff --git a/test/test_network_ops/test_grid_sampler_backwawrd.py b/test/test_network_ops/test_grid_sampler_backwawrd.py index a5b9b012735223cab5be77fb73ff5bc1c6210bd7..37fa2b2e4f9a8addcdb421bc68ace6dc864b1efc 100644 --- a/test/test_network_ops/test_grid_sampler_backwawrd.py +++ b/test/test_network_ops/test_grid_sampler_backwawrd.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_gru.py b/test/test_network_ops/test_gru.py index 2fdc2e17ef55329f06c07b5b1cbd4566a875e7fc..407e58eee942d492b0ed5b743d28ba1afb89d550 100644 --- a/test/test_network_ops/test_gru.py +++ b/test/test_network_ops/test_gru.py @@ -16,8 +16,8 @@ import copy 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_gru_backward.py b/test/test_network_ops/test_gru_backward.py index 7a1fa437172f4b62b7e03885268940503798e6d1..7ac6a154995adaff1a15e3d27fd84974a0364a52 100644 --- a/test/test_network_ops/test_gru_backward.py +++ b/test/test_network_ops/test_gru_backward.py @@ -16,8 +16,8 @@ import copy 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_gru_true.py b/test/test_network_ops/test_gru_true.py index 521fa5d57cf7df56cc7063086e040fa7e1893421..3b0809b55d1eb0a57fa815db3aaa622c05bae662 100644 --- a/test/test_network_ops/test_gru_true.py +++ b/test/test_network_ops/test_gru_true.py @@ -16,8 +16,8 @@ import copy 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_hammingwindow.py b/test/test_network_ops/test_hammingwindow.py index 2fb03b68350bbe9b2ee1b87145c29712905fce67..458c55fa76f8942f31869a43f74b549c641a1d69 100644 --- a/test/test_network_ops/test_hammingwindow.py +++ b/test/test_network_ops/test_hammingwindow.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_hann_window.py b/test/test_network_ops/test_hann_window.py index 4fa231531edb6e77288ce26a53a0b20b751f300a..44f6317d7b90fb9757c021ef029675a3d1e7bc6a 100644 --- a/test/test_network_ops/test_hann_window.py +++ b/test/test_network_ops/test_hann_window.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 diff --git a/test/test_network_ops/test_hard_swish.py b/test/test_network_ops/test_hard_swish.py index c1541d4d03d0a53596a7d13dbfa9fc0aa7ae8743..41759c5960f87e3edf9af50d585542c6d5526f26 100644 --- a/test/test_network_ops/test_hard_swish.py +++ b/test/test_network_ops/test_hard_swish.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_hard_swish_backward.py b/test/test_network_ops/test_hard_swish_backward.py index 7c3716d8b7e2d9fc91f9b005acb6a32992acafbc..747e03f9b1b59703de2d8af235341a57dc606a1f 100644 --- a/test/test_network_ops/test_hard_swish_backward.py +++ b/test/test_network_ops/test_hard_swish_backward.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_hardshrink.py b/test/test_network_ops/test_hardshrink.py index 5d0ea8770a9b6971dd4094092b7e9a1de4c634dc..63f4299d91cd4871fa4c580ee00b4f660bea0fa7 100644 --- a/test/test_network_ops/test_hardshrink.py +++ b/test/test_network_ops/test_hardshrink.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_hardshrink_backward.py b/test/test_network_ops/test_hardshrink_backward.py index e858c3aba029387a6142efb427f026346aaa7e30..a241168fe80719d772920be948572dd20a3f9677 100644 --- a/test/test_network_ops/test_hardshrink_backward.py +++ b/test/test_network_ops/test_hardshrink_backward.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_hardsigmoid.py b/test/test_network_ops/test_hardsigmoid.py index a4b5444503d173f92e5b8ecb9e559f6d8cccf977..55159f71e63b4e028d7db3b5a6bac3bc056e7512 100644 --- a/test/test_network_ops/test_hardsigmoid.py +++ b/test/test_network_ops/test_hardsigmoid.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_hardsigmoid_backward.py b/test/test_network_ops/test_hardsigmoid_backward.py index 7cd17ba8d857adc127d7c56927866887c816c654..3e51efad39e2743a8902a31b4655883a83ab0d10 100644 --- a/test/test_network_ops/test_hardsigmoid_backward.py +++ b/test/test_network_ops/test_hardsigmoid_backward.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_hardtanh.py b/test/test_network_ops/test_hardtanh.py index aec7d86c12bf6e83fef4095fe3f3b2ec0fdec92b..a76d4812faabcd60605d582e80f66c86fc496570 100644 --- a/test/test_network_ops/test_hardtanh.py +++ b/test/test_network_ops/test_hardtanh.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_hardtanh_backward.py b/test/test_network_ops/test_hardtanh_backward.py index ab2d832899c339ea47c228b0cf52700e9af6e298..a6c41c4adfb5e0301c0fb5a5ed712fd4b4c8c179 100644 --- a/test/test_network_ops/test_hardtanh_backward.py +++ b/test/test_network_ops/test_hardtanh_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 diff --git a/test/test_network_ops/test_ifmr.py b/test/test_network_ops/test_ifmr.py index 5153defdbef7d005ef05c8d3c795cebdefc50d86..5b9ce8d7410b18cb9bae5b56042f9163a46d50ca 100644 --- a/test/test_network_ops/test_ifmr.py +++ b/test/test_network_ops/test_ifmr.py @@ -15,8 +15,8 @@ from functools import reduce 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_im2col.py b/test/test_network_ops/test_im2col.py index 359e2e67bc580567ce4a90a4605e63f44a267491..95832555938a8fadf1cfea48636877aa0f1cad0e 100644 --- a/test/test_network_ops/test_im2col.py +++ b/test/test_network_ops/test_im2col.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_im2col_backward.py b/test/test_network_ops/test_im2col_backward.py index 1e82b36c4253da20446dccc930635b83aec00a8f..cca87dab1ec4e491278772b805dd4e507326fa3e 100644 --- a/test/test_network_ops/test_im2col_backward.py +++ b/test/test_network_ops/test_im2col_backward.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_index.py b/test/test_network_ops/test_index.py index 81be633c160cfa975ec4334cb5aa226fe59e7a7c..92029dc5d0a35df5a148435c284cc2411258e510 100644 --- a/test/test_network_ops/test_index.py +++ b/test/test_network_ops/test_index.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_index_add.py b/test/test_network_ops/test_index_add.py index b4be001a27f91b050314f279c8edae278ff5288b..c142538a7c8c90a886f9fc27244706a7dba79b5c 100644 --- a/test/test_network_ops/test_index_add.py +++ b/test/test_network_ops/test_index_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_index_fill.py b/test/test_network_ops/test_index_fill.py index 72c356ba27cf860c01eda3006b2010110bcaebc9..c50208187f19ec9f2df7c73fbbe8dcea0c49a49a 100644 --- a/test/test_network_ops/test_index_fill.py +++ b/test/test_network_ops/test_index_fill.py @@ -14,8 +14,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_index_put.py b/test/test_network_ops/test_index_put.py index 25370000e79873da8d4eddfe194dae6682e5ef14..36a22e81bf5c09334cf2868b6daf1bd38d619c33 100644 --- a/test/test_network_ops/test_index_put.py +++ b/test/test_network_ops/test_index_put.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_inverse.py b/test/test_network_ops/test_inverse.py index 0fbd101feb7af7cede5aa4303c526461275d40e4..3ae3f1560141815c3741e0eb93321521cffadcaf 100644 --- a/test/test_network_ops/test_inverse.py +++ b/test/test_network_ops/test_inverse.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_is_nonzero.py b/test/test_network_ops/test_is_nonzero.py index 51bd57b237747959d1330478bea82ccc74706ba4..241574821d7e61c2c046f0501102fe2e1bc22083 100644 --- a/test/test_network_ops/test_is_nonzero.py +++ b/test/test_network_ops/test_is_nonzero.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_isclose.py b/test/test_network_ops/test_isclose.py index 70e0fef3d0d2f766620d53aaf4c157e5581c9127..31900e7f4f30356b968e236afb1287f779bf60f3 100644 --- a/test/test_network_ops/test_isclose.py +++ b/test/test_network_ops/test_isclose.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_isfinite.py b/test/test_network_ops/test_isfinite.py index 4556af670be26f138870a673f2a6abdd637d600f..491745668024e22f490555fbca0ae0ce376bf4d8 100644 --- a/test/test_network_ops/test_isfinite.py +++ b/test/test_network_ops/test_isfinite.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_kl_div.py b/test/test_network_ops/test_kl_div.py index 149819c7a9fbbec1e7fa8ab82bb725d7a62c1a35..d99ae5716fc964bead36e38321daa75e1493a50b 100644 --- a/test/test_network_ops/test_kl_div.py +++ b/test/test_network_ops/test_kl_div.py @@ -13,9 +13,9 @@ # limitations under the License. import torch -import torch_npu import torch.nn.functional as F import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests diff --git a/test/test_network_ops/test_kl_div_backward.py b/test/test_network_ops/test_kl_div_backward.py index 75e541c3f3e08300f1548007e8a55d715b5e5ecf..4060ac5cd3ad2ff7dc48e151bc1f4b8dc4ca0e8d 100644 --- a/test/test_network_ops/test_kl_div_backward.py +++ b/test/test_network_ops/test_kl_div_backward.py @@ -13,9 +13,9 @@ # limitations under the License. import torch -import torch_npu import torch.nn.functional as F import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests diff --git a/test/test_network_ops/test_kthvalue.py b/test/test_network_ops/test_kthvalue.py index 6c23900e5cf6c9199d90f3f865087b32b227b309..bc14aee0a3368b2e00e99ea752b13c4320d0b969 100644 --- a/test/test_network_ops/test_kthvalue.py +++ b/test/test_network_ops/test_kthvalue.py @@ -14,8 +14,8 @@ import random 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_l1_loss.py b/test/test_network_ops/test_l1_loss.py index 21da5ba9f03e2d43f20986be88831e0f519dfb63..8c593a25013a1d10ecc3187fdcf871effb2ffce7 100644 --- a/test/test_network_ops/test_l1_loss.py +++ b/test/test_network_ops/test_l1_loss.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_l1_loss_backward.py b/test/test_network_ops/test_l1_loss_backward.py index 4ca08824062f0684332ef393ea20394548198559..316897313763146fb2d088fa723159061838f146 100644 --- a/test/test_network_ops/test_l1_loss_backward.py +++ b/test/test_network_ops/test_l1_loss_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_layer_norm.py b/test/test_network_ops/test_layer_norm.py index 3607a9190741435293147871603fcf4f4070c6ee..175d78dc5090e04bdaef65edae569d82d455cb47 100644 --- a/test/test_network_ops/test_layer_norm.py +++ b/test/test_network_ops/test_layer_norm.py @@ -14,9 +14,9 @@ # See the License for the specific language governing permissions and # 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_layer_norm_backward.py b/test/test_network_ops/test_layer_norm_backward.py index 69c1c6993fddeeb3d625f9457eb563def52cbd00..900e5d17478783168e157be733fab1abae49c800 100644 --- a/test/test_network_ops/test_layer_norm_backward.py +++ b/test/test_network_ops/test_layer_norm_backward.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_layer_norm_eval.py b/test/test_network_ops/test_layer_norm_eval.py index c8b134dd9a60f6eccb1be422f726c743b1dfc699..9f0a8273125687d9f37a9d98bb59f1186dd6b776 100644 --- a/test/test_network_ops/test_layer_norm_eval.py +++ b/test/test_network_ops/test_layer_norm_eval.py @@ -15,9 +15,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_le.py b/test/test_network_ops/test_le.py index b264026033c8c9caef2abddef2337a5de8e1a8c1..95bd393deb2307b92d9248212c9a4fc0dcb3873a 100644 --- a/test/test_network_ops/test_le.py +++ b/test/test_network_ops/test_le.py @@ -13,8 +13,8 @@ # limitations under the License. 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_leaky_relu.py b/test/test_network_ops/test_leaky_relu.py index c8d5ec26a509fd08cbc88d420f88b53d13749e01..2c96176d3dd36ce9be6f576562790f2775a04e97 100644 --- a/test/test_network_ops/test_leaky_relu.py +++ b/test/test_network_ops/test_leaky_relu.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_leaky_relu_backward.py b/test/test_network_ops/test_leaky_relu_backward.py index 980a8f9c2e4390d4a700ed824bc3417a01070697..e35f8bbc2a98eb33118d3b3231b3cd97b5702ec4 100644 --- a/test/test_network_ops/test_leaky_relu_backward.py +++ b/test/test_network_ops/test_leaky_relu_backward.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_lerp.py b/test/test_network_ops/test_lerp.py index 97d3cb5d19916f1543febd6502af83fd639d3582..1375a9379f8b3367763c123b695dbcaf0768ee6a 100644 --- a/test/test_network_ops/test_lerp.py +++ b/test/test_network_ops/test_lerp.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_linspace.py b/test/test_network_ops/test_linspace.py index 20b4388653d2b2917eeb7f8fb2558d83600ec76b..f8556ded71dbdeb42d1aeb61c483f07ac5abdd5f 100644 --- a/test/test_network_ops/test_linspace.py +++ b/test/test_network_ops/test_linspace.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_log.py b/test/test_network_ops/test_log.py index 64d42c7f04c3fab444d5ac6b3481efe7c7d46db3..ff61c95cd4dedd6c74c0c544b9a0c245d6f16e7d 100644 --- a/test/test_network_ops/test_log.py +++ b/test/test_network_ops/test_log.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_log10.py b/test/test_network_ops/test_log10.py index 7285611f949a0796c891eef09df8e1fc3d9e9af6..c0eb4cb3a2cdf757883a187595ab3d02491e1625 100644 --- a/test/test_network_ops/test_log10.py +++ b/test/test_network_ops/test_log10.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_log1p.py b/test/test_network_ops/test_log1p.py index fcce0222182717b7b921a9ab3d6b9df54a315f92..bf7596b0048b47129f853205044f7b5a34726058 100644 --- a/test/test_network_ops/test_log1p.py +++ b/test/test_network_ops/test_log1p.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_log2.py b/test/test_network_ops/test_log2.py index 2d988dd763c8f6028ccffb38098fef3eb31f9fdf..ad3fe1a1b1838c4773e64785338ac8f5c1c5e234 100644 --- a/test/test_network_ops/test_log2.py +++ b/test/test_network_ops/test_log2.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_log_softmax.py b/test/test_network_ops/test_log_softmax.py index 6a56b2b509fb1997b943f099a7ee1def26ad03d4..c1ffa91c2b10a6f2b1b3508b78a4c0816f33408f 100644 --- a/test/test_network_ops/test_log_softmax.py +++ b/test/test_network_ops/test_log_softmax.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_log_softmax_backward.py b/test/test_network_ops/test_log_softmax_backward.py index 8090d142829c1b1fe27715409dddc3419e10f064..435dded1394edd1505aa68d3eedc8a2eacaea3a3 100644 --- a/test/test_network_ops/test_log_softmax_backward.py +++ b/test/test_network_ops/test_log_softmax_backward.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_logical_and.py b/test/test_network_ops/test_logical_and.py index 9721e87d1e339a72f8713e83ded249522d195014..d3e9e0f5e426c80371698ea9aa4a47459411be71 100644 --- a/test/test_network_ops/test_logical_and.py +++ b/test/test_network_ops/test_logical_and.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_logical_not.py b/test/test_network_ops/test_logical_not.py index fbd67543933318b695374523a4cca5b2c6f6ac9d..b901dd24fb1fc23c313c466bc73ff0495023414f 100644 --- a/test/test_network_ops/test_logical_not.py +++ b/test/test_network_ops/test_logical_not.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_logical_or.py b/test/test_network_ops/test_logical_or.py index 07f716da93051d93744b996d45bd34cf34c310c7..c1e0bfb64a70c51e248eb6336357f3c00b904bca 100644 --- a/test/test_network_ops/test_logical_or.py +++ b/test/test_network_ops/test_logical_or.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_logsigmoid.py b/test/test_network_ops/test_logsigmoid.py index 0e9c19ffa51ef18948950cbb24c857631adb6195..d205ba49a0f54209f9528ca40d42b5919397c307 100644 --- a/test/test_network_ops/test_logsigmoid.py +++ b/test/test_network_ops/test_logsigmoid.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_logsigmoid_backward.py b/test/test_network_ops/test_logsigmoid_backward.py index 0419ed4732e691532da42ff5b0d8c3e6400af8ab..57c0b67ce89eb114a89097387540135a56d97f5e 100644 --- a/test/test_network_ops/test_logsigmoid_backward.py +++ b/test/test_network_ops/test_logsigmoid_backward.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_logsigmoidforward.py b/test/test_network_ops/test_logsigmoidforward.py index 6f95bd5ac2954c87616e7e2b501d375811f17621..bf2bf0b9107f7115f1c1e3cd8d763631a137da94 100644 --- a/test/test_network_ops/test_logsigmoidforward.py +++ b/test/test_network_ops/test_logsigmoidforward.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_logspace.py b/test/test_network_ops/test_logspace.py index 960af0e186160d1a257ebb9bf7f482963ed3fefa..bd5cb4f514536dfc762a6d63320aa93c181bfd9e 100644 --- a/test/test_network_ops/test_logspace.py +++ b/test/test_network_ops/test_logspace.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_logsumexp.py b/test/test_network_ops/test_logsumexp.py index 8cc676175f99ebc2be5a2d2c1da83f4c1c15b801..ca1f8b6cf1cdd3fd4b06ddfa72dd4d9821dd3592 100644 --- a/test/test_network_ops/test_logsumexp.py +++ b/test/test_network_ops/test_logsumexp.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_masked_fill.py b/test/test_network_ops/test_masked_fill.py index c31fefc93b7a184e840635a174e80a7cc676fc42..13ec782ff7d5e81b801a74d657948169e284a1b4 100644 --- a/test/test_network_ops/test_masked_fill.py +++ b/test/test_network_ops/test_masked_fill.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_masked_fill_range.py b/test/test_network_ops/test_masked_fill_range.py index 8f5066bfcdab2581210857636072ddd3ca00e62c..e7ea159c1691daa61b07d3501a261e1f6944af0e 100644 --- a/test/test_network_ops/test_masked_fill_range.py +++ b/test/test_network_ops/test_masked_fill_range.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_masked_scatter.py b/test/test_network_ops/test_masked_scatter.py index a7ae68ab4a2d1f3f21d8518efd3b2f8c8db60a0a..35c7d323d3086f343d678e6e76ad9898bdb198b1 100644 --- a/test/test_network_ops/test_masked_scatter.py +++ b/test/test_network_ops/test_masked_scatter.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_masked_select.py b/test/test_network_ops/test_masked_select.py index ecd2d718dc1f59f3608e395b883d8c0d63ff2b39..1ff0e28757304d34afabbefab36545b4c1e21e50 100644 --- a/test/test_network_ops/test_masked_select.py +++ b/test/test_network_ops/test_masked_select.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_matmul.py b/test/test_network_ops/test_matmul.py index 9ce02898d3115c022eec8b33466dc14a1116e6a6..40347b0871c8850c904af56cf4be5d8128fe3c32 100644 --- a/test/test_network_ops/test_matmul.py +++ b/test/test_network_ops/test_matmul.py @@ -13,9 +13,9 @@ # limitations under the License. import torch -import torch_npu import numpy as np import torch.nn as nn +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_max.py b/test/test_network_ops/test_max.py index 002204630a7713d056b9b030bb2f167dabf79037..e91462e7a76e8c7280451dd4492ca1cf6b2fc97d 100644 --- a/test/test_network_ops/test_max.py +++ b/test/test_network_ops/test_max.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_max_pool2d_with_indices.py b/test/test_network_ops/test_max_pool2d_with_indices.py index f3cc1a1df6ed0bb3dd6c47cb677bf48587e50483..aedd077ab99ea3f65628bfe46ff052375c425c58 100644 --- a/test/test_network_ops/test_max_pool2d_with_indices.py +++ b/test/test_network_ops/test_max_pool2d_with_indices.py @@ -15,9 +15,9 @@ # limitations under the License. import torch -import torch_npu import numpy as np import torch.nn.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 @@ -25,13 +25,15 @@ from torch_npu.testing.common_utils import create_common_tensor class TestMaxPool2dWithIndices(TestCase): def cpu_op_exec(self, inputCpu, kernel_size, stride, padding, dilation, ceil_mode): - dataCpu, argMaxCpu = F.max_pool2d_with_indices(inputCpu, kernel_size = kernel_size, stride = stride, padding = padding, dilation = dilation, - ceil_mode = ceil_mode, return_indices=True) + dataCpu, argMaxCpu = F.max_pool2d_with_indices(inputCpu, kernel_size = kernel_size, + stride = stride, padding = padding, dilation = dilation, + ceil_mode = ceil_mode, return_indices=True) return dataCpu,argMaxCpu def npu_op_exec(self, inputNpu, kernel_size, stride, padding, dilation, ceil_mode): - dataNpu, argMaxNpu = F.max_pool2d_with_indices(inputNpu, kernel_size = kernel_size, stride = stride, padding = padding, dilation = dilation, - ceil_mode = ceil_mode, return_indices=True) + dataNpu, argMaxNpu = F.max_pool2d_with_indices(inputNpu, kernel_size = kernel_size, + stride = stride, padding = padding, dilation = dilation, + ceil_mode = ceil_mode, return_indices=True) output1 = dataNpu.to("cpu").detach() output2 = argMaxNpu.to("cpu").detach() return output1, output2 diff --git a/test/test_network_ops/test_max_pool2d_with_indices_backward.py b/test/test_network_ops/test_max_pool2d_with_indices_backward.py index 4be67b71632f07680c7a1619f51471c5a81d5c62..126fc7bcb9523fa1df56aa9eea7fce2ac0c6af3b 100644 --- a/test/test_network_ops/test_max_pool2d_with_indices_backward.py +++ b/test/test_network_ops/test_max_pool2d_with_indices_backward.py @@ -15,9 +15,9 @@ # limitations under the License. import torch -import torch_npu import numpy as np import torch.nn.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 @@ -26,8 +26,9 @@ from torch_npu.testing.common_utils import create_common_tensor class TestMaxPool2dWithIndicesBackward(TestCase): def cpu_op_exec(self, inputCpu, kernel_size, stride, padding, dilation, ceil_mode): inputCpu.requires_grad = True - dataCpu, argMaxCpu = F.max_pool2d_with_indices(inputCpu, kernel_size = kernel_size, stride = stride, padding = padding, dilation = dilation, - ceil_mode = ceil_mode, return_indices=True) + dataCpu, argMaxCpu = F.max_pool2d_with_indices(inputCpu, kernel_size = kernel_size, + stride = stride, padding = padding, dilation = dilation, + ceil_mode = ceil_mode, return_indices=True) z1 = torch.sum(dataCpu) z1.backward() cpu_grad = inputCpu.grad @@ -36,8 +37,9 @@ class TestMaxPool2dWithIndicesBackward(TestCase): def npu_op_exec(self, inputNpu, kernel_size, stride, padding, dilation, ceil_mode): inputNpu.requires_grad = True - dataNpu, argMaxNpu = F.max_pool2d_with_indices(inputNpu, kernel_size = kernel_size, stride = stride, padding = padding, dilation = dilation, - ceil_mode = ceil_mode, return_indices=True) + dataNpu, argMaxNpu = F.max_pool2d_with_indices(inputNpu, kernel_size = kernel_size, + stride = stride, padding = padding, dilation = dilation, + ceil_mode = ceil_mode, return_indices=True) z2 = torch.sum(dataNpu) z2.backward() npu_grad = inputNpu.grad diff --git a/test/test_network_ops/test_max_pool3d_with_indices.py b/test/test_network_ops/test_max_pool3d_with_indices.py index 669280a1a8f8e4f31a075b5c4760e34b6ea1595f..8f282e96a9e1f888debd4e63a01f1f4a18888b04 100644 --- a/test/test_network_ops/test_max_pool3d_with_indices.py +++ b/test/test_network_ops/test_max_pool3d_with_indices.py @@ -15,9 +15,9 @@ # limitations under the License. import torch -import torch_npu import numpy as np import torch.nn.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 @@ -25,13 +25,15 @@ from torch_npu.testing.common_utils import create_common_tensor class TestMaxPool3dWithIndices(TestCase): def cpu_op_exec(self, inputCpu, kernel_size, stride, padding, dilation, ceil_mode): - dataCpu, argMaxCpu = F.max_pool3d_with_indices(inputCpu, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, - ceil_mode=ceil_mode, return_indices=True) + dataCpu, argMaxCpu = F.max_pool3d_with_indices(inputCpu, kernel_size=kernel_size, + stride=stride, padding=padding, dilation=dilation, + ceil_mode=ceil_mode, return_indices=True) return dataCpu,argMaxCpu def npu_op_exec(self, inputNpu, kernel_size, stride, padding, dilation, ceil_mode): - dataNpu, argMaxNpu = F.max_pool3d_with_indices(inputNpu, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, - ceil_mode=ceil_mode, return_indices=True) + dataNpu, argMaxNpu = F.max_pool3d_with_indices(inputNpu, kernel_size=kernel_size, + stride=stride, padding=padding, dilation=dilation, + ceil_mode=ceil_mode, return_indices=True) output1 = dataNpu.to("cpu").detach() output2 = argMaxNpu.to("cpu").detach() return output1, output2 diff --git a/test/test_network_ops/test_max_pool3d_withindices_backward.py b/test/test_network_ops/test_max_pool3d_withindices_backward.py index 3ac21f893686c1d229ae84fe54c9dc10616473f1..c35140e2c5541c2068f780d0904917a9f8078d01 100644 --- a/test/test_network_ops/test_max_pool3d_withindices_backward.py +++ b/test/test_network_ops/test_max_pool3d_withindices_backward.py @@ -15,9 +15,9 @@ # limitations under the License. import torch -import torch_npu import numpy as np import torch.nn.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_max_unpool3d.py b/test/test_network_ops/test_max_unpool3d.py index bf756805e3b9f449f759fb600897f0ea755374b8..1d55a2ff1859c5c73fbcf29b98651c457b1947a0 100644 --- a/test/test_network_ops/test_max_unpool3d.py +++ b/test/test_network_ops/test_max_unpool3d.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_max_unpool3d_backward.py b/test/test_network_ops/test_max_unpool3d_backward.py index fb8feb1b73abf623ff2b5a9158ca321d4f04e03f..83f281aaa48d4449cddbfde261aebd72586a089e 100644 --- a/test/test_network_ops/test_max_unpool3d_backward.py +++ b/test/test_network_ops/test_max_unpool3d_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_max_v1.py b/test/test_network_ops/test_max_v1.py index c955b0cbd1cbecae9af36f4fcf26b47414dc6eff..a2fd64ada0f2fcc4f54847c198f223dc5e055d6e 100644 --- a/test/test_network_ops/test_max_v1.py +++ b/test/test_network_ops/test_max_v1.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_median.py b/test/test_network_ops/test_median.py index c9dc0f701ba51632c61d4f12e12af759bb462da5..80c8820646cc3e0947f3f035df6767906579aa66 100644 --- a/test/test_network_ops/test_median.py +++ b/test/test_network_ops/test_median.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_min.py b/test/test_network_ops/test_min.py index f47a95de008efae0195dd6b0a7951c8012b7caa4..217c8332c67d8fc6661ad17df812c09aa86a017c 100644 --- a/test/test_network_ops/test_min.py +++ b/test/test_network_ops/test_min.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_mish.py b/test/test_network_ops/test_mish.py index e52d5d46f71450ff544865e0024e5049faa35dd3..ab371458af920d77473afb670b695a5292d0db4d 100644 --- a/test/test_network_ops/test_mish.py +++ b/test/test_network_ops/test_mish.py @@ -15,9 +15,9 @@ # limitations under the License. import torch -import torch_npu import torch.nn.functional as F 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_mish_backward.py b/test/test_network_ops/test_mish_backward.py index e0b4081ee93e10d8353c276a80b8a6beb39908e0..7797cdb04fd9b426fed04c6c2fa78eb18f112291 100644 --- a/test/test_network_ops/test_mish_backward.py +++ b/test/test_network_ops/test_mish_backward.py @@ -15,9 +15,9 @@ # limitations under the License. import torch -import torch_npu import torch.nn.functional as F 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_mse_loss.py b/test/test_network_ops/test_mse_loss.py index 349cad2716c81497d1f6dbf00eb1485fd1d02b97..b38b4d31e530098abf52fdc7df9caa1e4358832a 100644 --- a/test/test_network_ops/test_mse_loss.py +++ b/test/test_network_ops/test_mse_loss.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_mse_loss_backward.py b/test/test_network_ops/test_mse_loss_backward.py index 2e86e77640a68ddc63892c9596c56bb843c6bd09..c15e234b01f3d54c63b940c35610090fb234f236 100644 --- a/test/test_network_ops/test_mse_loss_backward.py +++ b/test/test_network_ops/test_mse_loss_backward.py @@ -14,9 +14,9 @@ # limitations under the License. import torch -import torch_npu from torch.autograd import Variable import numpy as np +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests diff --git a/test/test_network_ops/test_multilabel_margin_loss.py b/test/test_network_ops/test_multilabel_margin_loss.py index cd462c5457f1f0016e942103a16fb7e9ff92f47a..4727661bbb5d048c3a71a4243aef407e3f3ed988 100644 --- a/test/test_network_ops/test_multilabel_margin_loss.py +++ b/test/test_network_ops/test_multilabel_margin_loss.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 @@ -69,7 +69,8 @@ class TestMultilabelMarginLoss(TestCase): self.assertRtolEqual(cpu_output, npu_output) def test_multilabel_margin_loss_3(self, device="npu"): - data = torch.Tensor([[0.1, 0.2, 0.4, 0.8, 0.1, 0.1, 0.1, 0.1, 0.1], [0.1, 0.2, 0.4, 0.8, 0.1, 0.1, 0.1, 0.1, 0.1]]).to(torch.float32) + data = torch.Tensor([[0.1, 0.2, 0.4, 0.8, 0.1, 0.1, 0.1, 0.1, 0.1], + [0.1, 0.2, 0.4, 0.8, 0.1, 0.1, 0.1, 0.1, 0.1]]).to(torch.float32) target = torch.Tensor([[3, 0, 7, 8, 1, -1, 1, 2, 2], [4, 5, -1, 1, 1, 1, 1, 2, 2]]).to(torch.int64) for reduction in ["mean", "none", "sum"]: @@ -113,7 +114,8 @@ class TestMultilabelMarginLoss(TestCase): self.assertRtolEqual(cpu_output, npu_output) def test_multilabel_margin_loss_float16_2(self, device="npu"): - data = torch.Tensor([[0.1, 0.2, 0.4, 0.8, 0.1, 0.1, 0.1, 0.1, 0.1], [0.1, 0.2, 0.4, 0.8, 0.1, 0.1, 0.1, 0.1, 0.1]]).to(torch.float32) + data = torch.Tensor([[0.1, 0.2, 0.4, 0.8, 0.1, 0.1, 0.1, 0.1, 0.1], + [0.1, 0.2, 0.4, 0.8, 0.1, 0.1, 0.1, 0.1, 0.1]]).to(torch.float32) target = torch.Tensor([[3, 0, 7, 8, 1, -1, 1, 2, 2], [4, 5, -1, 1, 1, 1, 1, 2, 2]]).to(torch.int64) for reduction in ["mean", "none", "sum"]: diff --git a/test/test_network_ops/test_multinomial.py b/test/test_network_ops/test_multinomial.py index 6746d527b646459b085f5f4ad88e811eb51b6808..284c2768371828dac09f5f419f767e194875d277 100644 --- a/test/test_network_ops/test_multinomial.py +++ b/test/test_network_ops/test_multinomial.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_ne.py b/test/test_network_ops/test_ne.py index de4c0e9180873fda5375fabe971bbd39cf85a28c..7357c1a60d2c99ca68b11de1d68629288f8eeb7c 100644 --- a/test/test_network_ops/test_ne.py +++ b/test/test_network_ops/test_ne.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_nllloss2d_backward.py b/test/test_network_ops/test_nllloss2d_backward.py index d3ee2d605a466f206e9482d9d1f1b696fd17b6ac..3db7f315a27acf786d488480b7c236799f355ec1 100644 --- a/test/test_network_ops/test_nllloss2d_backward.py +++ b/test/test_network_ops/test_nllloss2d_backward.py @@ -13,9 +13,9 @@ # limitations under the License. import torch -import torch_npu import numpy as np from torch.autograd import Variable +import torch_npu from torch_npu.testing.testcase import TestCase, run_tests diff --git a/test/test_network_ops/test_nms_v4.py b/test/test_network_ops/test_nms_v4.py index c5aa47a9d84f703b3066423e07b85d6d0e133050..0dce0fa1c04ecf4fc39d932e5f06fbe9f921dc1b 100644 --- a/test/test_network_ops/test_nms_v4.py +++ b/test/test_network_ops/test_nms_v4.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_nms_with_mask.py b/test/test_network_ops/test_nms_with_mask.py index 6b367f1f298c23e1afc2538859869a69836abf2c..a10c9ecc1754cf754591977908daa9357b8825f9 100644 --- a/test/test_network_ops/test_nms_with_mask.py +++ b/test/test_network_ops/test_nms_with_mask.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_nnpack_spatial_convolution.py b/test/test_network_ops/test_nnpack_spatial_convolution.py index 8b8d71fb665f1cb66062b6b05b53a9ff2d9e3d4f..f1a4ba51c621ae39719380e01fcb4de16686c605 100644 --- a/test/test_network_ops/test_nnpack_spatial_convolution.py +++ b/test/test_network_ops/test_nnpack_spatial_convolution.py @@ -14,8 +14,8 @@ import unittest 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_nonzero.py b/test/test_network_ops/test_nonzero.py index 11c8d5167e18d50c2ca244bdcbe05fe6b8a41330..166225da431c57105366d3290f4b1ca57e7f910c 100644 --- a/test/test_network_ops/test_nonzero.py +++ b/test/test_network_ops/test_nonzero.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