From f6039929f7578780c1f2c47440d5870badc14829 Mon Sep 17 00:00:00 2001 From: Nyakku Shigure Date: Thu, 29 Sep 2022 10:46:33 +0800 Subject: [PATCH] [CodeStyle][F401] remove unused import in unittests/{asp,autograd,interpreter} (#46376) --- .../paddle/fluid/tests/unittests/asp/asp_pruning_base.py | 1 - .../tests/unittests/asp/test_asp_optimize_dynamic.py | 1 - .../tests/unittests/asp/test_asp_optimize_static.py | 1 - .../fluid/tests/unittests/asp/test_asp_pruning_static.py | 1 - .../tests/unittests/asp/test_fleet_with_asp_dynamic.py | 2 -- .../tests/unittests/asp/test_fleet_with_asp_sharding.py | 2 -- .../tests/unittests/asp/test_fleet_with_asp_static.py | 2 -- .../autograd/test_autograd_functional_dynamic.py | 8 ++------ .../unittests/autograd/test_autograd_functional_prim.py | 1 - .../autograd/test_autograd_functional_static.py | 2 -- .../tests/unittests/autograd/test_jvp_and_transpose.py | 2 +- .../fluid/tests/unittests/autograd/test_orig2prim.py | 3 +-- .../fluid/tests/unittests/autograd/test_prim2orig.py | 2 +- .../fluid/tests/unittests/autograd/test_primops.py | 3 +-- .../fluid/tests/unittests/autograd/test_transform.py | 1 - python/paddle/fluid/tests/unittests/autograd/utils.py | 5 ----- .../unittests/interpreter/test_standalone_controlflow.py | 4 ---- .../interpreter/test_standalone_multiply_write.py | 9 +-------- 18 files changed, 7 insertions(+), 43 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/asp/asp_pruning_base.py b/python/paddle/fluid/tests/unittests/asp/asp_pruning_base.py index 1fc7439624..6e9603e676 100644 --- a/python/paddle/fluid/tests/unittests/asp/asp_pruning_base.py +++ b/python/paddle/fluid/tests/unittests/asp/asp_pruning_base.py @@ -14,7 +14,6 @@ # limitations under the License. import unittest -import threading, time import paddle import paddle.fluid as fluid import paddle.fluid.core as core diff --git a/python/paddle/fluid/tests/unittests/asp/test_asp_optimize_dynamic.py b/python/paddle/fluid/tests/unittests/asp/test_asp_optimize_dynamic.py index cf4c4d6fcd..a501ed4279 100644 --- a/python/paddle/fluid/tests/unittests/asp/test_asp_optimize_dynamic.py +++ b/python/paddle/fluid/tests/unittests/asp/test_asp_optimize_dynamic.py @@ -15,7 +15,6 @@ import unittest import paddle -import paddle.fluid as fluid import paddle.fluid.core as core from paddle.fluid.contrib.sparsity.asp import ASPHelper import numpy as np diff --git a/python/paddle/fluid/tests/unittests/asp/test_asp_optimize_static.py b/python/paddle/fluid/tests/unittests/asp/test_asp_optimize_static.py index edfe3c1927..b689a40f88 100644 --- a/python/paddle/fluid/tests/unittests/asp/test_asp_optimize_static.py +++ b/python/paddle/fluid/tests/unittests/asp/test_asp_optimize_static.py @@ -14,7 +14,6 @@ # limitations under the License. import unittest -import threading, time import paddle import paddle.fluid as fluid import paddle.fluid.core as core diff --git a/python/paddle/fluid/tests/unittests/asp/test_asp_pruning_static.py b/python/paddle/fluid/tests/unittests/asp/test_asp_pruning_static.py index 1ee25114b8..084fbeef2d 100644 --- a/python/paddle/fluid/tests/unittests/asp/test_asp_pruning_static.py +++ b/python/paddle/fluid/tests/unittests/asp/test_asp_pruning_static.py @@ -14,7 +14,6 @@ # limitations under the License. import unittest -import threading, time import paddle import paddle.fluid as fluid import paddle.fluid.core as core diff --git a/python/paddle/fluid/tests/unittests/asp/test_fleet_with_asp_dynamic.py b/python/paddle/fluid/tests/unittests/asp/test_fleet_with_asp_dynamic.py index 09f6096574..d132b319f5 100644 --- a/python/paddle/fluid/tests/unittests/asp/test_fleet_with_asp_dynamic.py +++ b/python/paddle/fluid/tests/unittests/asp/test_fleet_with_asp_dynamic.py @@ -14,10 +14,8 @@ # limitations under the License. import paddle.distributed.fleet as fleet -import paddle.distributed.fleet.base.role_maker as role_maker import unittest import paddle -import paddle.fluid as fluid import paddle.fluid.core as core import os from paddle.fluid.contrib.sparsity.asp import ASPHelper diff --git a/python/paddle/fluid/tests/unittests/asp/test_fleet_with_asp_sharding.py b/python/paddle/fluid/tests/unittests/asp/test_fleet_with_asp_sharding.py index bd4e40ce6c..e5ff5f839e 100644 --- a/python/paddle/fluid/tests/unittests/asp/test_fleet_with_asp_sharding.py +++ b/python/paddle/fluid/tests/unittests/asp/test_fleet_with_asp_sharding.py @@ -14,11 +14,9 @@ # limitations under the License. import paddle.distributed.fleet as fleet -import paddle.distributed.fleet.base.role_maker as role_maker import unittest import paddle import paddle.fluid as fluid -import paddle.fluid.core as core import os from paddle.static import sparsity from paddle.fluid.contrib.sparsity.asp import ASPHelper diff --git a/python/paddle/fluid/tests/unittests/asp/test_fleet_with_asp_static.py b/python/paddle/fluid/tests/unittests/asp/test_fleet_with_asp_static.py index 4465dee4d7..f205610179 100644 --- a/python/paddle/fluid/tests/unittests/asp/test_fleet_with_asp_static.py +++ b/python/paddle/fluid/tests/unittests/asp/test_fleet_with_asp_static.py @@ -14,11 +14,9 @@ # limitations under the License. import paddle.distributed.fleet as fleet -import paddle.distributed.fleet.base.role_maker as role_maker import unittest import paddle import paddle.fluid as fluid -import paddle.fluid.core as core import os from paddle.static import sparsity from paddle.fluid.contrib.sparsity.asp import ASPHelper diff --git a/python/paddle/fluid/tests/unittests/autograd/test_autograd_functional_dynamic.py b/python/paddle/fluid/tests/unittests/autograd/test_autograd_functional_dynamic.py index 5eda21eb4c..054edf2ea2 100644 --- a/python/paddle/fluid/tests/unittests/autograd/test_autograd_functional_dynamic.py +++ b/python/paddle/fluid/tests/unittests/autograd/test_autograd_functional_dynamic.py @@ -19,17 +19,13 @@ import unittest import numpy as np import paddle import paddle.fluid as fluid -import paddle.compat as cpt import paddle.nn.functional as F from paddle.incubate.autograd.utils import as_tensors -from paddle.fluid.framework import _test_eager_guard, _in_legacy_dygraph, _in_eager_without_dygraph_check +from paddle.fluid.framework import _test_eager_guard import config import utils -from utils import (_compute_numerical_batch_hessian, _compute_numerical_hessian, - _compute_numerical_vhp, _compute_numerical_jacobian, - _compute_numerical_batch_jacobian) -from utils import matmul, mul, nested, o2, pow, reduce, reduce_dim, unuse +from utils import matmul, mul, nested, o2, reduce, reduce_dim def make_v(f, inputs): diff --git a/python/paddle/fluid/tests/unittests/autograd/test_autograd_functional_prim.py b/python/paddle/fluid/tests/unittests/autograd/test_autograd_functional_prim.py index d17420c904..de12fd1ef9 100644 --- a/python/paddle/fluid/tests/unittests/autograd/test_autograd_functional_prim.py +++ b/python/paddle/fluid/tests/unittests/autograd/test_autograd_functional_prim.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import typing import unittest import numpy as np diff --git a/python/paddle/fluid/tests/unittests/autograd/test_autograd_functional_static.py b/python/paddle/fluid/tests/unittests/autograd/test_autograd_functional_static.py index df63703652..2102cd81ca 100644 --- a/python/paddle/fluid/tests/unittests/autograd/test_autograd_functional_static.py +++ b/python/paddle/fluid/tests/unittests/autograd/test_autograd_functional_static.py @@ -21,8 +21,6 @@ import paddle.fluid as fluid import config import utils -from utils import (_compute_numerical_batch_jacobian, - _compute_numerical_jacobian) paddle.enable_static() diff --git a/python/paddle/fluid/tests/unittests/autograd/test_jvp_and_transpose.py b/python/paddle/fluid/tests/unittests/autograd/test_jvp_and_transpose.py index 4a92f1bc65..f345f58394 100644 --- a/python/paddle/fluid/tests/unittests/autograd/test_jvp_and_transpose.py +++ b/python/paddle/fluid/tests/unittests/autograd/test_jvp_and_transpose.py @@ -17,7 +17,7 @@ import unittest import paddle from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.layers.utils import flatten -from paddle.incubate.autograd.primrules import _orig2prim, _prim2orig, _jvp, _transpose +from paddle.incubate.autograd.primrules import _jvp, _transpose paddle.enable_static() diff --git a/python/paddle/fluid/tests/unittests/autograd/test_orig2prim.py b/python/paddle/fluid/tests/unittests/autograd/test_orig2prim.py index fe7b37941b..4a311fef1d 100644 --- a/python/paddle/fluid/tests/unittests/autograd/test_orig2prim.py +++ b/python/paddle/fluid/tests/unittests/autograd/test_orig2prim.py @@ -17,8 +17,7 @@ import unittest import paddle from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.layers.utils import flatten -from paddle.incubate.autograd.primrules import _orig2prim, _prim2orig, _jvp, _transpose -import paddle.fluid.core as core +from paddle.incubate.autograd.primrules import _orig2prim paddle.enable_static() diff --git a/python/paddle/fluid/tests/unittests/autograd/test_prim2orig.py b/python/paddle/fluid/tests/unittests/autograd/test_prim2orig.py index a1f80e5506..add39fd472 100644 --- a/python/paddle/fluid/tests/unittests/autograd/test_prim2orig.py +++ b/python/paddle/fluid/tests/unittests/autograd/test_prim2orig.py @@ -17,7 +17,7 @@ import unittest import paddle from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.layers.utils import flatten -from paddle.incubate.autograd.primrules import _orig2prim, _prim2orig, _jvp, _transpose +from paddle.incubate.autograd.primrules import _prim2orig paddle.enable_static() diff --git a/python/paddle/fluid/tests/unittests/autograd/test_primops.py b/python/paddle/fluid/tests/unittests/autograd/test_primops.py index 35291432f6..677c064bb7 100644 --- a/python/paddle/fluid/tests/unittests/autograd/test_primops.py +++ b/python/paddle/fluid/tests/unittests/autograd/test_primops.py @@ -17,8 +17,7 @@ import uuid import numpy as np import paddle from numpy.random import randint, randn -from paddle.incubate.autograd import primops, primx -from paddle.incubate.autograd import utils as prim_utils +from paddle.incubate.autograd import primops import config import utils diff --git a/python/paddle/fluid/tests/unittests/autograd/test_transform.py b/python/paddle/fluid/tests/unittests/autograd/test_transform.py index 32ef176fa5..f29b0d9b71 100644 --- a/python/paddle/fluid/tests/unittests/autograd/test_transform.py +++ b/python/paddle/fluid/tests/unittests/autograd/test_transform.py @@ -13,7 +13,6 @@ # limitations under the License. import unittest -import numpy as np import paddle from paddle.incubate.autograd.primx import Transform, orig2prim, prim2orig diff --git a/python/paddle/fluid/tests/unittests/autograd/utils.py b/python/paddle/fluid/tests/unittests/autograd/utils.py index d410dd32dd..e7bde31e54 100644 --- a/python/paddle/fluid/tests/unittests/autograd/utils.py +++ b/python/paddle/fluid/tests/unittests/autograd/utils.py @@ -15,11 +15,6 @@ import typing import enum import sys -import re -import inspect -import functools -import contextlib -import collections import numpy as np import paddle from paddle.incubate.autograd.utils import as_tensors diff --git a/python/paddle/fluid/tests/unittests/interpreter/test_standalone_controlflow.py b/python/paddle/fluid/tests/unittests/interpreter/test_standalone_controlflow.py index ef56e087f5..5482eda544 100644 --- a/python/paddle/fluid/tests/unittests/interpreter/test_standalone_controlflow.py +++ b/python/paddle/fluid/tests/unittests/interpreter/test_standalone_controlflow.py @@ -12,13 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os -import sys import unittest import paddle from paddle.fluid import core, framework -from paddle.fluid.core import StandaloneExecutor -import paddle.fluid as fluid from paddle.fluid.framework import Program, program_guard import paddle.fluid.layers as layers diff --git a/python/paddle/fluid/tests/unittests/interpreter/test_standalone_multiply_write.py b/python/paddle/fluid/tests/unittests/interpreter/test_standalone_multiply_write.py index a4d18d29be..0a707d1683 100644 --- a/python/paddle/fluid/tests/unittests/interpreter/test_standalone_multiply_write.py +++ b/python/paddle/fluid/tests/unittests/interpreter/test_standalone_multiply_write.py @@ -12,18 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os -import sys import unittest import paddle -from paddle.fluid import core -from paddle.fluid.core import StandaloneExecutor -import paddle.fluid as fluid -from paddle.fluid.framework import Program, program_guard -import paddle.fluid.layers as layers +from paddle.fluid.framework import Program from test_standalone_controlflow import TestCompatibility -import numpy as np paddle.enable_static() -- GitLab