diff --git a/python/paddle/fluid/tests/unittests/test_fake_dequantize_op.py b/python/paddle/fluid/tests/unittests/test_fake_dequantize_op.py index a1c1532459ed3fe7dd3ed0c847825c8aff842ecd..239f5a93b1f9f69f9660b7431b4f7411a1d74923 100644 --- a/python/paddle/fluid/tests/unittests/test_fake_dequantize_op.py +++ b/python/paddle/fluid/tests/unittests/test_fake_dequantize_op.py @@ -16,7 +16,6 @@ import unittest import numpy as np import math from op_test import OpTest -import paddle.fluid.core as core def quantize_max_abs(x, max_range): diff --git a/python/paddle/fluid/tests/unittests/test_faster_tokenizer_op.py b/python/paddle/fluid/tests/unittests/test_faster_tokenizer_op.py index e797b250fae07f7d80f655b756ef27bc25375827..44aa0225059ee01a0f79243f1166ee84f2d155e0 100755 --- a/python/paddle/fluid/tests/unittests/test_faster_tokenizer_op.py +++ b/python/paddle/fluid/tests/unittests/test_faster_tokenizer_op.py @@ -12,17 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -import io import os import unittest import numpy as np import paddle import paddle.nn as nn -from paddle.dataset.common import DATA_HOME from paddle.fluid.framework import core, _non_static_mode, _test_eager_guard from paddle.fluid.layer_helper import LayerHelper -from paddle import _C_ops, _legacy_C_ops +from paddle import _legacy_C_ops import sys import tempfile diff --git a/python/paddle/fluid/tests/unittests/test_feed_data_check_shape_type.py b/python/paddle/fluid/tests/unittests/test_feed_data_check_shape_type.py index 97a0c8ebc96c3e52c5cc42d0f153ef15ca112a55..be58e03f661af9146d09de00eb804698ed32348d 100644 --- a/python/paddle/fluid/tests/unittests/test_feed_data_check_shape_type.py +++ b/python/paddle/fluid/tests/unittests/test_feed_data_check_shape_type.py @@ -19,7 +19,6 @@ import paddle import paddle.fluid as fluid import paddle.fluid.compiler as compiler import paddle.fluid.core as core -import six import unittest os.environ['CPU_NUM'] = str(4) diff --git a/python/paddle/fluid/tests/unittests/test_fetch_lod_tensor_array.py b/python/paddle/fluid/tests/unittests/test_fetch_lod_tensor_array.py index 649384cc76791e4e2f496baa45f06c45b790cd6f..2b59c88948ddec40921f10d94fa9b2a9003b8302 100644 --- a/python/paddle/fluid/tests/unittests/test_fetch_lod_tensor_array.py +++ b/python/paddle/fluid/tests/unittests/test_fetch_lod_tensor_array.py @@ -15,8 +15,6 @@ import os import numpy as np import unittest -import random -import paddle import paddle.fluid as fluid import paddle.fluid.layers as layers from simple_nets import simple_fc_net_with_inputs, simple_fc_net diff --git a/python/paddle/fluid/tests/unittests/test_fetch_unmerged.py b/python/paddle/fluid/tests/unittests/test_fetch_unmerged.py index ab8ea8d3e4bd3d9c746fda52518b7a0879b82f9a..e9ce5294c37e7088f3af80cb9fe44f4aaf0f0fd5 100644 --- a/python/paddle/fluid/tests/unittests/test_fetch_unmerged.py +++ b/python/paddle/fluid/tests/unittests/test_fetch_unmerged.py @@ -14,10 +14,8 @@ import os import unittest -import random import numpy as np import paddle.fluid as fluid -import six import paddle os.environ["CPU_NUM"] = "2" diff --git a/python/paddle/fluid/tests/unittests/test_fetch_var.py b/python/paddle/fluid/tests/unittests/test_fetch_var.py index 71c32623d0806537fa4911b732ffd9fc31954987..1ce597ef98ad15031edec6a3f58a22ac93987b7c 100644 --- a/python/paddle/fluid/tests/unittests/test_fetch_var.py +++ b/python/paddle/fluid/tests/unittests/test_fetch_var.py @@ -14,7 +14,6 @@ import paddle.fluid as fluid import paddle.fluid.layers as layers -import op_test import numpy as np import unittest diff --git a/python/paddle/fluid/tests/unittests/test_fill_any_like_op.py b/python/paddle/fluid/tests/unittests/test_fill_any_like_op.py index 711aeb15e199fdd6d133f586cfd9f1f45de5327a..fae7b3c2b0a0a6c5401d41d0656c433dc80e5dc0 100644 --- a/python/paddle/fluid/tests/unittests/test_fill_any_like_op.py +++ b/python/paddle/fluid/tests/unittests/test_fill_any_like_op.py @@ -13,10 +13,7 @@ # limitations under the License. import paddle -import paddle.fluid as fluid import paddle.fluid.core as core -from paddle.fluid import Program, program_guard -import paddle.compat as cpt import unittest import numpy as np from op_test import OpTest, convert_float_to_uint16 diff --git a/python/paddle/fluid/tests/unittests/test_fill_any_op.py b/python/paddle/fluid/tests/unittests/test_fill_any_op.py index 794bd170b69be61849849673f34f98892bb0a25c..7dbdfe8d58a6c1850067a7a4866312b888d74207 100644 --- a/python/paddle/fluid/tests/unittests/test_fill_any_op.py +++ b/python/paddle/fluid/tests/unittests/test_fill_any_op.py @@ -13,12 +13,9 @@ # limitations under the License. import paddle -import paddle.fluid.core as core -from paddle.fluid.framework import _test_eager_guard, in_dygraph_mode import unittest import numpy as np from op_test import OpTest -from paddle.tensor.manipulation import fill_ class TestFillAnyOp(OpTest): diff --git a/python/paddle/fluid/tests/unittests/test_fill_constant_batch_size_like.py b/python/paddle/fluid/tests/unittests/test_fill_constant_batch_size_like.py index e6296eb94d0fa4394177563ab1f5c43bb6b75e12..ebe0ed179d2779963693d613fbd608c99821005d 100644 --- a/python/paddle/fluid/tests/unittests/test_fill_constant_batch_size_like.py +++ b/python/paddle/fluid/tests/unittests/test_fill_constant_batch_size_like.py @@ -13,9 +13,6 @@ # limitations under the License. import paddle -import paddle.fluid.core as core -from paddle.static import program_guard, Program -import paddle.compat as cpt import unittest import numpy as np from op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/test_fill_constant_op.py b/python/paddle/fluid/tests/unittests/test_fill_constant_op.py index 904ce15215fdbac36606863227a819f48811deec..4737d209395bea89b22189bb3dfc7e8f5940545e 100644 --- a/python/paddle/fluid/tests/unittests/test_fill_constant_op.py +++ b/python/paddle/fluid/tests/unittests/test_fill_constant_op.py @@ -21,7 +21,7 @@ import paddle.fluid.core as core from paddle.fluid.op import Operator import paddle.fluid as fluid import numpy as np -from paddle.fluid import compiler, Program, program_guard +from paddle.fluid import Program, program_guard # Situation 1: Attr(shape) is a list(without tensor) diff --git a/python/paddle/fluid/tests/unittests/test_fill_diagonal_tensor_op.py b/python/paddle/fluid/tests/unittests/test_fill_diagonal_tensor_op.py index a35dd611cb2e9ce0803b0fdded40ccead1d77227..9823f5e25851913f2a759349bdeaf23abc76a408 100644 --- a/python/paddle/fluid/tests/unittests/test_fill_diagonal_tensor_op.py +++ b/python/paddle/fluid/tests/unittests/test_fill_diagonal_tensor_op.py @@ -12,14 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.fluid as fluid -import paddle.nn.functional as F import unittest import numpy as np -import six import paddle from op_test import OpTest -from paddle.fluid.layers import core def fill_diagonal_ndarray(x, value, offset=0, dim1=0, dim2=1): diff --git a/python/paddle/fluid/tests/unittests/test_filter_by_instag_op.py b/python/paddle/fluid/tests/unittests/test_filter_by_instag_op.py index c7818712f0a66e959b2f4a85181f486ecf796759..b60dcbe9c899b1951ad6891d5d0075860a484452 100644 --- a/python/paddle/fluid/tests/unittests/test_filter_by_instag_op.py +++ b/python/paddle/fluid/tests/unittests/test_filter_by_instag_op.py @@ -15,13 +15,7 @@ import unittest import numpy as np -import paddle.fluid as fluid -import paddle.fluid.core as core -import paddle.fluid.layers as layers from op_test import OpTest -import random -from decorator_helper import prog_scope -from paddle.fluid.op import Operator """This is Test Case 1""" diff --git a/python/paddle/fluid/tests/unittests/test_flatten_contiguous_range_op.py b/python/paddle/fluid/tests/unittests/test_flatten_contiguous_range_op.py index 991c13a6ecfd594233a1f65cda39c7f83b8d7368..b938adfbf1426a519c1a7a30ca6e45ce18d5c8c3 100644 --- a/python/paddle/fluid/tests/unittests/test_flatten_contiguous_range_op.py +++ b/python/paddle/fluid/tests/unittests/test_flatten_contiguous_range_op.py @@ -14,7 +14,6 @@ import unittest import numpy as np -import paddle.fluid as fluid import paddle from op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/test_fleet.py b/python/paddle/fluid/tests/unittests/test_fleet.py index b0dec291cad37fcc29aa91549fa95fbd7b2229eb..a06f264750978e95d3c6e890f9144ffc6a7e04d7 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet.py +++ b/python/paddle/fluid/tests/unittests/test_fleet.py @@ -15,7 +15,6 @@ import os import unittest -import paddle.fluid.incubate.fleet.base.role_maker as role_maker class TestFleet1(unittest.TestCase): @@ -34,7 +33,6 @@ class TestFleet1(unittest.TestCase): """Test cases for pslib.""" import paddle.fluid as fluid from paddle.fluid.incubate.fleet.parameter_server.pslib import fleet - from paddle.fluid.incubate.fleet.parameter_server.pslib import PSLib from paddle.fluid.incubate.fleet.base.role_maker import GeneralRoleMaker os.environ["POD_IP"] = "127.0.0.1" diff --git a/python/paddle/fluid/tests/unittests/test_fleet_ascend_utils.py b/python/paddle/fluid/tests/unittests/test_fleet_ascend_utils.py index 1dda13e88b3cc6b69ab37318b7489940aa30b37a..7ee6ee83f22c9bbce7aa52262ca73a55c87cae5a 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_ascend_utils.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_ascend_utils.py @@ -12,14 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys -import os -import time -import six -import copy import json import unittest -import paddle.fluid as fluid import paddle.distributed.fleet.ascend_utils as ascend_utils diff --git a/python/paddle/fluid/tests/unittests/test_fleet_auto.py b/python/paddle/fluid/tests/unittests/test_fleet_auto.py index 7f37e7b2a44ac7a3a57c9b1277c071d2c34fde46..29710dc5885684217734239d746fa7d4aca66e68 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_auto.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_auto.py @@ -16,7 +16,6 @@ import unittest import paddle import os import paddle.distributed.fleet as fleet -import paddle.distributed.fleet.base.role_maker as role_maker paddle.enable_static() diff --git a/python/paddle/fluid/tests/unittests/test_fleet_base.py b/python/paddle/fluid/tests/unittests/test_fleet_base.py index 46263d1a10ec09c08751e8a157b782f4d05d5cae..aba343b1f2952ba1df5dd1d4cac805e0ede9bad3 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_base.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_base.py @@ -18,7 +18,6 @@ import paddle.distributed.fleet as fleet import paddle.distributed.fleet.base.role_maker as role_maker import os import paddle.fluid as fluid -import paddle.nn as nn import numpy as np diff --git a/python/paddle/fluid/tests/unittests/test_fleet_base_3.py b/python/paddle/fluid/tests/unittests/test_fleet_base_3.py index c81d96bafd332478aa1490d2ab30f5ec9c1a9684..40ee3836dd27d4da5cc782164ee2ad736cd1db02 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_base_3.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_base_3.py @@ -17,7 +17,6 @@ import os import paddle import paddle.distributed.fleet as fleet import paddle.distributed.fleet.base.role_maker as role_maker -import paddle.fluid as fluid paddle.enable_static() diff --git a/python/paddle/fluid/tests/unittests/test_fleet_base_4.py b/python/paddle/fluid/tests/unittests/test_fleet_base_4.py index fa154285f21a3acc9f840dffce30097cf86cb12d..5d70193212cf953786b51e57ecd34bf150ee2397 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_base_4.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_base_4.py @@ -15,7 +15,6 @@ import unittest import paddle import os -import paddle.fluid as fluid import paddle.distributed.fleet as fleet paddle.enable_static() diff --git a/python/paddle/fluid/tests/unittests/test_fleet_base_single.py b/python/paddle/fluid/tests/unittests/test_fleet_base_single.py index a782bf3842d8233ea3ee1425fc6cb83f8eeda061..776a286d97de4fa88363d70f51c293bd43e41394 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_base_single.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_base_single.py @@ -22,7 +22,6 @@ else: os.environ['CUDA_VISIBLE_DEVICES'] = cuda_visible_devices.split(',')[0] import paddle import paddle.distributed.fleet as fleet -import paddle.distributed.fleet.base.role_maker as role_maker import paddle.fluid as fluid import unittest import paddle.nn as nn diff --git a/python/paddle/fluid/tests/unittests/test_fleet_elastic_collective.py b/python/paddle/fluid/tests/unittests/test_fleet_elastic_collective.py index 7e37c8ff0869d09586e932a85ec629e0e05deda6..8d31fc4efb50c8fdde0470cbdba95f97149db668 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_elastic_collective.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_elastic_collective.py @@ -13,13 +13,8 @@ # limitations under the License. import os -import time -import json import unittest -import argparse import tempfile -import traceback -from warnings import catch_warnings from paddle.distributed.fleet.elastic.collective import CollectiveLauncher from paddle.distributed.fleet.launch import launch_collective diff --git a/python/paddle/fluid/tests/unittests/test_fleet_elastic_init.py b/python/paddle/fluid/tests/unittests/test_fleet_elastic_init.py index cd3272fd9d811c57f87a8d6a3a46152481d15e83..e32f74ffb14591a5c5b703e1a47cb433e27de7b5 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_elastic_init.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_elastic_init.py @@ -12,11 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os -import time import unittest -import argparse -from warnings import catch_warnings from paddle.distributed.fleet.elastic import enable_elastic, launch_elastic from paddle.distributed.fleet.launch_utils import DistributeMode diff --git a/python/paddle/fluid/tests/unittests/test_fleet_elastic_manager.py b/python/paddle/fluid/tests/unittests/test_fleet_elastic_manager.py index 1994e5021e99f91efb13864772890fcb063123cf..3c07edc78037eb85c7efa3d3312a8ec38debb64c 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_elastic_manager.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_elastic_manager.py @@ -13,13 +13,10 @@ # limitations under the License. import os -import time import unittest -import argparse from paddle.distributed.fleet.elastic.manager import ElasticManager from paddle.distributed.fleet.elastic.manager import LauncherInterface -from paddle.distributed.fleet.elastic.manager import ELASTIC_TIMEOUT from paddle.distributed.fleet.elastic.manager import ELASTIC_AUTO_PARALLEL_EXIT_CODE diff --git a/python/paddle/fluid/tests/unittests/test_fleet_executor_utils.py b/python/paddle/fluid/tests/unittests/test_fleet_executor_utils.py index a8fe4f05b9993a85640e1ced70ac15aa87990e1b..cbc54e8c70f5c3644f7e34abfd13054917cc2530 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_executor_utils.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_executor_utils.py @@ -14,8 +14,7 @@ import unittest import paddle -import paddle.fluid.core as core -from paddle.distributed.fleet.fleet_executor_utils import TaskNode, FleetExecutorUtils +from paddle.distributed.fleet.fleet_executor_utils import FleetExecutorUtils paddle.enable_static() diff --git a/python/paddle/fluid/tests/unittests/test_fleet_metric.py b/python/paddle/fluid/tests/unittests/test_fleet_metric.py index 9141033165d559c8c1448c71f73b026718a52c4a..f4af98e649db270845750455615d8bc9481a5671 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_metric.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_metric.py @@ -16,7 +16,6 @@ import numpy as np import paddle import paddle.fluid as fluid -import os import unittest import numpy as np import paddle.distributed.fleet.metrics.metric as metric diff --git a/python/paddle/fluid/tests/unittests/test_fleet_nocvm_1.py b/python/paddle/fluid/tests/unittests/test_fleet_nocvm_1.py index 67c75550c044059eebe5097170c841d24a46e337..81daea3af9310cba658487f42db6ce5469e86195 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_nocvm_1.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_nocvm_1.py @@ -15,7 +15,6 @@ import os import unittest -import paddle.fluid.incubate.fleet.base.role_maker as role_maker class TestFleet1(unittest.TestCase): @@ -33,7 +32,6 @@ class TestFleet1(unittest.TestCase): """Test cases for pslib.""" import paddle.fluid as fluid from paddle.fluid.incubate.fleet.parameter_server.pslib import fleet - from paddle.fluid.incubate.fleet.parameter_server.pslib import PSLib from paddle.fluid.incubate.fleet.base.role_maker import GeneralRoleMaker os.environ["POD_IP"] = "127.0.0.1" diff --git a/python/paddle/fluid/tests/unittests/test_fleet_rolemaker.py b/python/paddle/fluid/tests/unittests/test_fleet_rolemaker.py index b422503d34afa56e9ddeca69af26c9e233ec8393..9824b59028fad29b7cafd2eec666aed0dfeca232 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_rolemaker.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_rolemaker.py @@ -61,7 +61,6 @@ class TestCloudRoleMaker(unittest.TestCase): """Test cases for pslib.""" import paddle.fluid as fluid from paddle.fluid.incubate.fleet.parameter_server.pslib import fleet - from paddle.fluid.incubate.fleet.parameter_server.pslib import PSLib from paddle.fluid.incubate.fleet.base.role_maker import GeneralRoleMaker os.environ["POD_IP"] = "127.0.0.1" diff --git a/python/paddle/fluid/tests/unittests/test_fleet_rolemaker_2.py b/python/paddle/fluid/tests/unittests/test_fleet_rolemaker_2.py index 6049ba3fee8ddfad25d50cdcb3d5ed8dc922df64..b60c43a209a14798fee4a791615fe4de7369e3a2 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_rolemaker_2.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_rolemaker_2.py @@ -18,8 +18,6 @@ import os import unittest import tempfile -import paddle.fluid.incubate.fleet.base.role_maker as role_maker - class TestCloudRoleMaker2(unittest.TestCase): """ diff --git a/python/paddle/fluid/tests/unittests/test_fleet_rolemaker_3.py b/python/paddle/fluid/tests/unittests/test_fleet_rolemaker_3.py index a8ad393ca6ca40c8cb43db198f96259ecc02f545..2e639a8167984b53a6aca124953f9cb0be9c82d5 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_rolemaker_3.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_rolemaker_3.py @@ -15,7 +15,6 @@ import os import unittest -import paddle.fluid.incubate.fleet.base.role_maker as role_maker class TestCloudRoleMaker(unittest.TestCase): @@ -33,7 +32,6 @@ class TestCloudRoleMaker(unittest.TestCase): """Test cases for pslib.""" import paddle.fluid as fluid from paddle.fluid.incubate.fleet.parameter_server.pslib import fleet - from paddle.fluid.incubate.fleet.parameter_server.pslib import PSLib from paddle.fluid.incubate.fleet.base.role_maker import GeneralRoleMaker os.environ["POD_IP"] = "127.0.0.1" diff --git a/python/paddle/fluid/tests/unittests/test_fleet_rolemaker_4.py b/python/paddle/fluid/tests/unittests/test_fleet_rolemaker_4.py index 2f7aeb62215ea3a7cce354a50516105168d992d8..14d5277446bb0032cdafbaded2bda328bceeced0 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_rolemaker_4.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_rolemaker_4.py @@ -15,7 +15,6 @@ import os import unittest -import paddle.fluid.incubate.fleet.base.role_maker as role_maker class TestCloudRoleMaker(unittest.TestCase): @@ -31,14 +30,8 @@ class TestCloudRoleMaker(unittest.TestCase): def test_pslib_1(self): """Test cases for pslib.""" - import sys import threading - import paddle.fluid as fluid try: - from paddle.fluid.incubate.fleet.parameter_server.pslib import fleet - from paddle.fluid.incubate.fleet.parameter_server.pslib import PSLib - from paddle.fluid.incubate.fleet.base.role_maker import \ - GeneralRoleMaker from paddle.distributed.fleet.utils.http_server import KVHandler from paddle.distributed.fleet.utils.http_server import KVServer from paddle.distributed.fleet.utils.http_server import KVHTTPServer @@ -74,8 +67,6 @@ class TestCloudRoleMaker(unittest.TestCase): raise ValueError("this is only for test") return "fake" - import os - try: class TmpKVHander(KVHandler): @@ -126,8 +117,6 @@ class TestCloudRoleMaker(unittest.TestCase): print("warning: no KVHandler, skip test_pslib_4") return - import sys - try: class TmpServer(KVHTTPServer): diff --git a/python/paddle/fluid/tests/unittests/test_fleet_rolemaker_init.py b/python/paddle/fluid/tests/unittests/test_fleet_rolemaker_init.py index 7743331eae1f3d596281947fa6b8e9ea75d7717e..dfc88afaf1f9d1760ee81f2bbb17e4118eb0fd4e 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_rolemaker_init.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_rolemaker_init.py @@ -14,11 +14,7 @@ """Test cloud role maker.""" import os -import platform -import shutil -import tempfile import unittest -import paddle import paddle.distributed.fleet.base.role_maker as role_maker diff --git a/python/paddle/fluid/tests/unittests/test_fleet_runtime.py b/python/paddle/fluid/tests/unittests/test_fleet_runtime.py index 19c407bf57f83aba69c78de2f48411575534ed3e..21a0afab0126a9323e7679bfcd2f6538f4a22f68 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_runtime.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_runtime.py @@ -14,7 +14,6 @@ import unittest import paddle -import os class TestFleetRuntime(unittest.TestCase): diff --git a/python/paddle/fluid/tests/unittests/test_fleet_unitaccessor.py b/python/paddle/fluid/tests/unittests/test_fleet_unitaccessor.py index a930b74042d73b21eccff969c792248434821acb..09cc08dc327c26a9ae4fda0d3f55a7fe46a1b1f1 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_unitaccessor.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_unitaccessor.py @@ -15,7 +15,6 @@ import os import unittest -import paddle.fluid.incubate.fleet.base.role_maker as role_maker class TestFleet1(unittest.TestCase): @@ -33,7 +32,6 @@ class TestFleet1(unittest.TestCase): """Test cases for pslib.""" import paddle.fluid as fluid from paddle.fluid.incubate.fleet.parameter_server.pslib import fleet - from paddle.fluid.incubate.fleet.parameter_server.pslib import PSLib from paddle.fluid.incubate.fleet.base.role_maker import GeneralRoleMaker os.environ["POD_IP"] = "127.0.0.1" diff --git a/python/paddle/fluid/tests/unittests/test_fleet_util.py b/python/paddle/fluid/tests/unittests/test_fleet_util.py index de55ac2f080ad6f44e3af7e6a75c9f930c59ea53..1b6f2cf85527746e63fdeb0d8b174f4f2429c153 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_util.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_util.py @@ -12,15 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -import paddle.fluid as fluid import unittest import numpy as np import tarfile import tempfile import os import sys -from paddle.dataset.common import download, DATA_HOME +from paddle.dataset.common import download import paddle.distributed.fleet.base.role_maker as role_maker diff --git a/python/paddle/fluid/tests/unittests/test_flip.py b/python/paddle/fluid/tests/unittests/test_flip.py index 3cd060cced0ff2b5652c82a516705968a33006c9..ddf3534ad336c9208d4cb43b4b8d9aa71a5064db 100644 --- a/python/paddle/fluid/tests/unittests/test_flip.py +++ b/python/paddle/fluid/tests/unittests/test_flip.py @@ -17,7 +17,6 @@ import numpy as np import paddle import paddle.fluid as fluid import paddle.fluid.core as core -from paddle.fluid import Program, program_guard from op_test import OpTest import gradient_checker from decorator_helper import prog_scope diff --git a/python/paddle/fluid/tests/unittests/test_fold_op.py b/python/paddle/fluid/tests/unittests/test_fold_op.py index e3b1b267cb271ff88c24d01cdda06d1a7e755f8c..62833173909e3208d3cd3ed5093344c1bd912bb9 100644 --- a/python/paddle/fluid/tests/unittests/test_fold_op.py +++ b/python/paddle/fluid/tests/unittests/test_fold_op.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import math import numpy as np import unittest from op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/test_fs_interface.py b/python/paddle/fluid/tests/unittests/test_fs_interface.py index e97093c8cd5515c94741022eda86d0939ed41428..22e07f9030f2fd9a4df732152ca983efeebcb28b 100644 --- a/python/paddle/fluid/tests/unittests/test_fs_interface.py +++ b/python/paddle/fluid/tests/unittests/test_fs_interface.py @@ -13,14 +13,10 @@ # limitations under the License. import unittest -import paddle.fluid as fluid -import paddle.fluid.incubate.fleet.base.role_maker as role_maker -from paddle.fluid.incubate.fleet.collective import CollectiveOptimizer, fleet -import os import sys import inspect -from paddle.distributed.fleet.utils.fs import LocalFS, FS, HDFSClient, FSTimeOut, FSFileExistsError, FSFileNotExistsError +from paddle.distributed.fleet.utils.fs import FS class FSTest(unittest.TestCase): diff --git a/python/paddle/fluid/tests/unittests/test_fsp_op.py b/python/paddle/fluid/tests/unittests/test_fsp_op.py index 0f7eb4ad95d04dfc15b24e93767f61ecebdf8757..bac40a98d4b17c6f600ddb8c3b7ede64892cc7c6 100644 --- a/python/paddle/fluid/tests/unittests/test_fsp_op.py +++ b/python/paddle/fluid/tests/unittests/test_fsp_op.py @@ -15,9 +15,7 @@ import unittest import numpy as np from op_test import OpTest -import paddle.fluid.core as core import paddle.fluid as fluid -from paddle.fluid import compiler, Program, program_guard def fsp_matrix(a, b): diff --git a/python/paddle/fluid/tests/unittests/test_full_like_op.py b/python/paddle/fluid/tests/unittests/test_full_like_op.py index cb4d69389d89a6e424be08c98b92b83748e7e6f5..fe565140e70c473d20192f91cfc50b86709ed188 100644 --- a/python/paddle/fluid/tests/unittests/test_full_like_op.py +++ b/python/paddle/fluid/tests/unittests/test_full_like_op.py @@ -15,7 +15,6 @@ import paddle import paddle.fluid.core as core from paddle.static import program_guard, Program -import paddle.compat as cpt import unittest import numpy as np from op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/test_full_op.py b/python/paddle/fluid/tests/unittests/test_full_op.py index b214a0b6573fba62630cca36307a8428464dadb0..c55e17923be9e1761ad319abdf71a325f77097fa 100644 --- a/python/paddle/fluid/tests/unittests/test_full_op.py +++ b/python/paddle/fluid/tests/unittests/test_full_op.py @@ -14,13 +14,10 @@ import unittest import numpy as np -from op_test import OpTest -import paddle.fluid.core as core -from paddle.fluid.op import Operator import paddle.fluid as fluid import paddle -from paddle.fluid import compiler, Program, program_guard +from paddle.fluid import Program, program_guard from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_function_hook.py b/python/paddle/fluid/tests/unittests/test_function_hook.py index 1ea1e503ab913e98ad7ea5879f6334834c54ddb3..b884d62e7d32ed6f4a2bd192c9cebce80f37ddfd 100644 --- a/python/paddle/fluid/tests/unittests/test_function_hook.py +++ b/python/paddle/fluid/tests/unittests/test_function_hook.py @@ -16,8 +16,7 @@ import unittest import paddle import numpy as np -import paddle.fluid.core as core -from paddle import _C_ops, _legacy_C_ops +from paddle import _legacy_C_ops from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_functional_conv1d.py b/python/paddle/fluid/tests/unittests/test_functional_conv1d.py index 88dd98f1f3a32987ecff4903d479f4539c13b130..251ac52451d7eeb0e1fa6326f788dc8abd2a2ad3 100644 --- a/python/paddle/fluid/tests/unittests/test_functional_conv1d.py +++ b/python/paddle/fluid/tests/unittests/test_functional_conv1d.py @@ -14,9 +14,7 @@ import paddle import paddle.nn.functional as F -from paddle import fluid import paddle.fluid.dygraph as dg -import paddle.fluid.initializer as I import numpy as np import unittest from unittest import TestCase diff --git a/python/paddle/fluid/tests/unittests/test_functional_conv1d_transpose.py b/python/paddle/fluid/tests/unittests/test_functional_conv1d_transpose.py index 3d719de3674924f02ae86e57a0641850faa8f808..98daff216a760c34f2c4684134ee34fd88024979 100644 --- a/python/paddle/fluid/tests/unittests/test_functional_conv1d_transpose.py +++ b/python/paddle/fluid/tests/unittests/test_functional_conv1d_transpose.py @@ -14,9 +14,7 @@ import paddle import paddle.nn.functional as F -from paddle import fluid import paddle.fluid.dygraph as dg -import paddle.fluid.initializer as I import numpy as np import unittest from unittest import TestCase diff --git a/python/paddle/fluid/tests/unittests/test_fuse_bn_add_act_pass.py b/python/paddle/fluid/tests/unittests/test_fuse_bn_add_act_pass.py index a89d18b6b12e6b0b41dd88ae85231f4c35732759..67c4879a05ada507d72ed4b19f0613fca4dcf997 100644 --- a/python/paddle/fluid/tests/unittests/test_fuse_bn_add_act_pass.py +++ b/python/paddle/fluid/tests/unittests/test_fuse_bn_add_act_pass.py @@ -14,7 +14,6 @@ import unittest import numpy as np -from op_test import OpTest import paddle import paddle.fluid as fluid from paddle.fluid import core diff --git a/python/paddle/fluid/tests/unittests/test_fuse_gemm_epilogue_pass.py b/python/paddle/fluid/tests/unittests/test_fuse_gemm_epilogue_pass.py index de75cca6f45c5d72a2cf38b72fd3df83561b12a0..1d7dc0e70d4aa0238893ca957c948c85d1a16dd3 100644 --- a/python/paddle/fluid/tests/unittests/test_fuse_gemm_epilogue_pass.py +++ b/python/paddle/fluid/tests/unittests/test_fuse_gemm_epilogue_pass.py @@ -15,7 +15,6 @@ """Test cases for role makers.""" import paddle -import os import unittest import numpy as np import paddle.fluid.core as core diff --git a/python/paddle/fluid/tests/unittests/test_fuse_optimizer_pass.py b/python/paddle/fluid/tests/unittests/test_fuse_optimizer_pass.py index 981d9dfcf4a56c6e56c14ffcda0b612f2f9b1532..5021870e9b62db8c109222578478d632e932cbbf 100644 --- a/python/paddle/fluid/tests/unittests/test_fuse_optimizer_pass.py +++ b/python/paddle/fluid/tests/unittests/test_fuse_optimizer_pass.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from simple_nets import simple_fc_net, fc_with_batchnorm, init_data, bow_net +from simple_nets import bow_net, fc_with_batchnorm, init_data from fake_reader import fake_imdb_reader from parallel_executor_test_base import TestParallelExecutorBase, DeviceType from functools import partial diff --git a/python/paddle/fluid/tests/unittests/test_fuse_relu_depthwise_conv_pass.py b/python/paddle/fluid/tests/unittests/test_fuse_relu_depthwise_conv_pass.py index a9e9a588e857dc17c51ec075b9ef5418f2b035fe..a93c1380c0b316603aea085c5f57e284798638e5 100644 --- a/python/paddle/fluid/tests/unittests/test_fuse_relu_depthwise_conv_pass.py +++ b/python/paddle/fluid/tests/unittests/test_fuse_relu_depthwise_conv_pass.py @@ -17,9 +17,7 @@ import paddle.fluid as fluid import paddle.fluid.core as core import numpy as np import paddle -import paddle.dataset.mnist as mnist import unittest -import os def norm(*args, **kargs): diff --git a/python/paddle/fluid/tests/unittests/test_fused_attention_op.py b/python/paddle/fluid/tests/unittests/test_fused_attention_op.py index 1ad29ecadd7bfdfaf0cdcf915fc50a0301cec40e..1e27005499a093143d4e9550d85aa7314a64edea 100644 --- a/python/paddle/fluid/tests/unittests/test_fused_attention_op.py +++ b/python/paddle/fluid/tests/unittests/test_fused_attention_op.py @@ -15,8 +15,6 @@ import numpy as np import paddle -import paddle.nn as nn -import paddle.fluid.core as core import paddle.nn.functional as F import paddle.incubate.nn.functional as incubate_f from paddle.nn.layer.norm import LayerNorm diff --git a/python/paddle/fluid/tests/unittests/test_fused_attention_op_api.py b/python/paddle/fluid/tests/unittests/test_fused_attention_op_api.py index bf8983eee842f25aced4703a71a8fe06ceadfdf4..ee8efdc81d0b3492772abd964fe03a9d9c3aeeaa 100644 --- a/python/paddle/fluid/tests/unittests/test_fused_attention_op_api.py +++ b/python/paddle/fluid/tests/unittests/test_fused_attention_op_api.py @@ -15,13 +15,8 @@ import numpy as np import paddle -import paddle.nn as nn -import paddle.fluid.core as core -import paddle.nn.functional as F from paddle.incubate.nn.layer.fused_transformer import FusedMultiHeadAttention -from paddle import tensor -from paddle.fluid import layers -from paddle.static import Program, program_guard +from paddle.static import Program import unittest diff --git a/python/paddle/fluid/tests/unittests/test_fused_bias_dropout_residual_layer_norm_op.py b/python/paddle/fluid/tests/unittests/test_fused_bias_dropout_residual_layer_norm_op.py index f31cc78986e5652d2d5ec1f02a5732df2923e8e0..7572a1dfe14ded0c7c6e9cb16e938bbdf482ea86 100644 --- a/python/paddle/fluid/tests/unittests/test_fused_bias_dropout_residual_layer_norm_op.py +++ b/python/paddle/fluid/tests/unittests/test_fused_bias_dropout_residual_layer_norm_op.py @@ -15,15 +15,9 @@ import numpy as np import paddle -import paddle.nn as nn -import paddle.fluid.core as core -import paddle.nn.functional as F import paddle.incubate.nn.functional as incubate_f from paddle.nn.layer.norm import LayerNorm -from paddle.nn.layer.common import Linear, Dropout -from paddle.nn.layer.transformer import _convert_attention_mask -from paddle import tensor -from paddle.fluid import layers +from paddle.nn.layer.common import Dropout import unittest from op_test import OpTest from paddle.fluid.framework import default_main_program, _enable_legacy_dygraph diff --git a/python/paddle/fluid/tests/unittests/test_fused_bias_dropout_residual_layer_norm_op_api.py b/python/paddle/fluid/tests/unittests/test_fused_bias_dropout_residual_layer_norm_op_api.py index f0c6bd83d40dd5acc72b24ecc7a2c7ea3506c0b5..aa54860e0996bee1c75d6718827c050630983e1f 100644 --- a/python/paddle/fluid/tests/unittests/test_fused_bias_dropout_residual_layer_norm_op_api.py +++ b/python/paddle/fluid/tests/unittests/test_fused_bias_dropout_residual_layer_norm_op_api.py @@ -15,13 +15,8 @@ import numpy as np import paddle -import paddle.nn as nn -import paddle.fluid.core as core -import paddle.nn.functional as F from paddle.incubate.nn.layer.fused_transformer import FusedBiasDropoutResidualLayerNorm -from paddle import tensor -from paddle.fluid import layers -from paddle.static import Program, program_guard +from paddle.static import Program import unittest diff --git a/python/paddle/fluid/tests/unittests/test_fused_emb_seq_pool_op.py b/python/paddle/fluid/tests/unittests/test_fused_emb_seq_pool_op.py index cec35cbe0f8aecbd79155e5e6a51b5e37d5de18c..5963ef07e92a57ddefe76cb12893f7731bacee69 100644 --- a/python/paddle/fluid/tests/unittests/test_fused_emb_seq_pool_op.py +++ b/python/paddle/fluid/tests/unittests/test_fused_emb_seq_pool_op.py @@ -16,10 +16,6 @@ import unittest import platform import numpy as np from op_test import OpTest, skip_check_grad_ci -import paddle.fluid.core as core -import paddle.fluid as fluid -from paddle.fluid.op import Operator -import paddle.compat as cpt import paddle.version as ver diff --git a/python/paddle/fluid/tests/unittests/test_fused_feedforward_op.py b/python/paddle/fluid/tests/unittests/test_fused_feedforward_op.py index f979e896fbd9a2ac82bb29a555fd5b1226f71a49..85b7ee9285d869950cf86ce7ec16d3655cff1feb 100644 --- a/python/paddle/fluid/tests/unittests/test_fused_feedforward_op.py +++ b/python/paddle/fluid/tests/unittests/test_fused_feedforward_op.py @@ -14,8 +14,6 @@ import numpy as np import paddle -import paddle.fluid as fluid -import paddle.fluid.core as core from paddle.nn.layer import transformer import paddle.nn.functional as F import paddle.incubate.nn.functional as incubate_f diff --git a/python/paddle/fluid/tests/unittests/test_fused_gate_attention_op.py b/python/paddle/fluid/tests/unittests/test_fused_gate_attention_op.py index f911d614ee49bf12f1e41a1e3bfad207ff9fada2..2baab279462d0379ccee873aca36297e7642b782 100644 --- a/python/paddle/fluid/tests/unittests/test_fused_gate_attention_op.py +++ b/python/paddle/fluid/tests/unittests/test_fused_gate_attention_op.py @@ -21,12 +21,10 @@ import numpy as np import paddle import paddle.nn as nn -from paddle import tensor import unittest from op_test import OpTest, convert_float_to_uint16, convert_uint16_to_float from test_sparse_attention_op import get_cuda_version -from paddle import _C_ops, _legacy_C_ops -from paddle.fluid.framework import default_main_program +from paddle import _legacy_C_ops from paddle.fluid import core diff --git a/python/paddle/fluid/tests/unittests/test_fused_multi_transformer_int8_op.py b/python/paddle/fluid/tests/unittests/test_fused_multi_transformer_int8_op.py index 00f25b4570c0bd0ffd8041a1b0d3fe30edaee24c..3384e86668eaee9cb1b0ca452aedcefa02a494f3 100644 --- a/python/paddle/fluid/tests/unittests/test_fused_multi_transformer_int8_op.py +++ b/python/paddle/fluid/tests/unittests/test_fused_multi_transformer_int8_op.py @@ -15,23 +15,15 @@ import numpy as np import paddle -import paddle.nn as nn -import paddle.fluid.core as core import paddle.nn.functional as F -import paddle.incubate.nn.functional as incubate_f from paddle.nn.layer.norm import LayerNorm -from paddle.nn.layer.common import Linear, Dropout +from paddle.nn.layer.common import Dropout from paddle.nn.layer.transformer import _convert_attention_mask from paddle import tensor from paddle.fluid import layers import unittest -from op_test import OpTest from paddle.fluid.framework import default_main_program -from paddle.fluid.dygraph.layers import Layer -from paddle.fluid.layer_helper import LayerHelper -from paddle.nn.initializer import Constant -from paddle.fluid.data_feeder import check_variable_and_dtype, check_dtype -from paddle.fluid.framework import _non_static_mode, default_main_program +from paddle.fluid.framework import default_main_program from paddle import _legacy_C_ops default_main_program().random_seed = 42 diff --git a/python/paddle/fluid/tests/unittests/test_fused_multi_transformer_op.py b/python/paddle/fluid/tests/unittests/test_fused_multi_transformer_op.py index b91081aa89a6f3edc9d32faa83006c1387131b4e..dcfb72940403cebb2c192136d91f20cf1b994889 100644 --- a/python/paddle/fluid/tests/unittests/test_fused_multi_transformer_op.py +++ b/python/paddle/fluid/tests/unittests/test_fused_multi_transformer_op.py @@ -15,10 +15,7 @@ import numpy as np import paddle -import paddle.nn as nn -import paddle.fluid.core as core import paddle.nn.functional as F -import paddle.incubate.nn.functional as incubate_f from paddle.nn.layer.norm import LayerNorm from paddle.nn.layer.common import Linear, Dropout from paddle.nn.layer.transformer import _convert_attention_mask @@ -27,12 +24,7 @@ from paddle.fluid import layers import unittest from op_test import OpTest from paddle.fluid.framework import default_main_program -from paddle.fluid.dygraph.layers import Layer -from paddle.fluid.layer_helper import LayerHelper -from paddle.nn.initializer import Constant -from paddle.fluid.data_feeder import check_variable_and_dtype, check_dtype -from paddle.fluid.framework import _non_static_mode, default_main_program -from paddle import _C_ops, _legacy_C_ops +from paddle.fluid.framework import default_main_program from paddle.incubate.nn.functional import fused_multi_transformer from paddle.incubate.nn import FusedMultiTransformer diff --git a/python/paddle/fluid/tests/unittests/test_fused_multihead_matmul_op.py b/python/paddle/fluid/tests/unittests/test_fused_multihead_matmul_op.py index 3292d1ae47ce553334a6aa854a12e446e755ba02..717a98abd50bbde1381b756f2da13f8930907f0c 100644 --- a/python/paddle/fluid/tests/unittests/test_fused_multihead_matmul_op.py +++ b/python/paddle/fluid/tests/unittests/test_fused_multihead_matmul_op.py @@ -16,7 +16,6 @@ import unittest import numpy as np from op_test import OpTest from paddle.fluid import core -import paddle.fluid as fluid np.random.random(123) diff --git a/python/paddle/fluid/tests/unittests/test_fused_token_prune_op.py b/python/paddle/fluid/tests/unittests/test_fused_token_prune_op.py index 9425283f078c001e7353809896ba43a32d8d935c..adfb9e0917776394db750059717be1ff96329534 100644 --- a/python/paddle/fluid/tests/unittests/test_fused_token_prune_op.py +++ b/python/paddle/fluid/tests/unittests/test_fused_token_prune_op.py @@ -14,7 +14,6 @@ import unittest import numpy as np -import paddle from op_test import OpTest from paddle.framework import core diff --git a/python/paddle/fluid/tests/unittests/test_fusion_gru_op.py b/python/paddle/fluid/tests/unittests/test_fusion_gru_op.py index d3b0faa72dea9255e4f967597d82fef7c5be4223..e2aa2fc901e0674120152907535ab17565237ead 100644 --- a/python/paddle/fluid/tests/unittests/test_fusion_gru_op.py +++ b/python/paddle/fluid/tests/unittests/test_fusion_gru_op.py @@ -14,7 +14,6 @@ import unittest import numpy as np -import math from op_test import OpTest from paddle.fluid.tests.unittests.test_gru_op import gru from paddle.fluid.tests.unittests.test_fusion_lstm_op import fc, ACTIVATION diff --git a/python/paddle/fluid/tests/unittests/test_fusion_seqconv_eltadd_relu_op.py b/python/paddle/fluid/tests/unittests/test_fusion_seqconv_eltadd_relu_op.py index d64bb77bbbda30d2f13cad94fb4785818381648c..cceced75adc8ee5e88e75aee5d8ad41f81062e96 100644 --- a/python/paddle/fluid/tests/unittests/test_fusion_seqconv_eltadd_relu_op.py +++ b/python/paddle/fluid/tests/unittests/test_fusion_seqconv_eltadd_relu_op.py @@ -14,7 +14,6 @@ import unittest import numpy as np -import random from op_test import OpTest from sequence.test_sequence_conv import seqconv diff --git a/python/paddle/fluid/tests/unittests/test_gaussian_random_op.py b/python/paddle/fluid/tests/unittests/test_gaussian_random_op.py index 331aa0f20fabb8f8def06c18b56c7e1168aff00f..16e34dc67898db78c689146c36d5d1503b757e81 100644 --- a/python/paddle/fluid/tests/unittests/test_gaussian_random_op.py +++ b/python/paddle/fluid/tests/unittests/test_gaussian_random_op.py @@ -12,14 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os import unittest import numpy as np import paddle import paddle.fluid as fluid import paddle.fluid.core as core -from paddle.fluid.op import Operator -from paddle.fluid.executor import Executor from paddle.fluid.tests.unittests.op_test import OpTest, convert_uint16_to_float from paddle.fluid.framework import _test_eager_guard import paddle diff --git a/python/paddle/fluid/tests/unittests/test_gcd.py b/python/paddle/fluid/tests/unittests/test_gcd.py index b64e307fb52121cf3314d68a351f9555d22cc484..d5ef16cea423cf574bf73fabf706c5763d7a060e 100644 --- a/python/paddle/fluid/tests/unittests/test_gcd.py +++ b/python/paddle/fluid/tests/unittests/test_gcd.py @@ -17,8 +17,6 @@ import numpy as np import paddle import paddle.fluid as fluid import paddle.fluid.core as core -from paddle.fluid import Program, program_guard -from op_test import OpTest paddle.enable_static() diff --git a/python/paddle/fluid/tests/unittests/test_generate_mask_labels_op.py b/python/paddle/fluid/tests/unittests/test_generate_mask_labels_op.py index 93dcfdadf6a228c8384b8331350abc3dc365fd40..3a2a6e9eb502c1cfdf6a140c4743d4ae47d9fa41 100644 --- a/python/paddle/fluid/tests/unittests/test_generate_mask_labels_op.py +++ b/python/paddle/fluid/tests/unittests/test_generate_mask_labels_op.py @@ -14,10 +14,8 @@ import unittest import numpy as np -import sys import math import six -import paddle.fluid as fluid from op_test import OpTest ''' # Equivalent code diff --git a/python/paddle/fluid/tests/unittests/test_generate_proposal_labels_op.py b/python/paddle/fluid/tests/unittests/test_generate_proposal_labels_op.py index 0c5a6756717d4942854f5bf5aaccd21dfb517395..4b5a5ebc2ba99073ce3500c00081cdb86dd776cb 100644 --- a/python/paddle/fluid/tests/unittests/test_generate_proposal_labels_op.py +++ b/python/paddle/fluid/tests/unittests/test_generate_proposal_labels_op.py @@ -14,9 +14,6 @@ import unittest import numpy as np -import sys -import math -import paddle.fluid as fluid from op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/test_generate_proposals_op.py b/python/paddle/fluid/tests/unittests/test_generate_proposals_op.py index 496d2ca12753d034fc6a4fe8ace292a38ff0918a..d5fbca5be9ecbfcb3c14ae7dd0077931ddeece22 100644 --- a/python/paddle/fluid/tests/unittests/test_generate_proposals_op.py +++ b/python/paddle/fluid/tests/unittests/test_generate_proposals_op.py @@ -14,10 +14,8 @@ import unittest import numpy as np -import sys import math import paddle -import paddle.fluid as fluid from op_test import OpTest from test_anchor_generator_op import anchor_generator_in_python import copy diff --git a/python/paddle/fluid/tests/unittests/test_generate_proposals_v2_op.py b/python/paddle/fluid/tests/unittests/test_generate_proposals_v2_op.py index f25ff6b7d726b1086862b6abffb03031d8955386..06db10c5bd5128d3f7d7e56ce4328a33a3cdbaba 100644 --- a/python/paddle/fluid/tests/unittests/test_generate_proposals_v2_op.py +++ b/python/paddle/fluid/tests/unittests/test_generate_proposals_v2_op.py @@ -14,13 +14,9 @@ import unittest import numpy as np -import sys -import math import paddle -import paddle.fluid as fluid from op_test import OpTest from test_anchor_generator_op import anchor_generator_in_python -import copy from test_generate_proposals_op import clip_tiled_boxes, box_coder, nms diff --git a/python/paddle/fluid/tests/unittests/test_generator.py b/python/paddle/fluid/tests/unittests/test_generator.py index 99d740f195828ba6da16fc19f32b6a56d4ab8588..515581029ab74ccfb9bdc84d9bb3f3ad42655b99 100644 --- a/python/paddle/fluid/tests/unittests/test_generator.py +++ b/python/paddle/fluid/tests/unittests/test_generator.py @@ -13,7 +13,6 @@ # limitations under the License. """Test cloud role maker.""" -import os import unittest import paddle import paddle.fluid.generator as generator diff --git a/python/paddle/fluid/tests/unittests/test_get_all_op_or_kernel_names.py b/python/paddle/fluid/tests/unittests/test_get_all_op_or_kernel_names.py index 0a07305507f3ddffc38e227d3574c3638d1003dd..999912494ad3018b1108ebc8f7ab4e435bec868b 100644 --- a/python/paddle/fluid/tests/unittests/test_get_all_op_or_kernel_names.py +++ b/python/paddle/fluid/tests/unittests/test_get_all_op_or_kernel_names.py @@ -14,7 +14,6 @@ import unittest from paddle.fluid import core -from paddle import compat as cpt class TestGetAllRegisteredOpKernels(unittest.TestCase): diff --git a/python/paddle/fluid/tests/unittests/test_get_device_properties.py b/python/paddle/fluid/tests/unittests/test_get_device_properties.py index 750a257b0d96041a8c6055c06d0f1bac67a0448e..e29b565ff459c921f5c12b7420b1b77a058e69f8 100644 --- a/python/paddle/fluid/tests/unittests/test_get_device_properties.py +++ b/python/paddle/fluid/tests/unittests/test_get_device_properties.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle import unittest from paddle.fluid import core from paddle.device.cuda import device_count, get_device_properties diff --git a/python/paddle/fluid/tests/unittests/test_gpu_package_without_gpu_device.py b/python/paddle/fluid/tests/unittests/test_gpu_package_without_gpu_device.py index ecfe0f05a668fa3b490127ea5f006ffd158f2985..fc130426aef84b512286e182d6db579a8de69b59 100644 --- a/python/paddle/fluid/tests/unittests/test_gpu_package_without_gpu_device.py +++ b/python/paddle/fluid/tests/unittests/test_gpu_package_without_gpu_device.py @@ -16,9 +16,7 @@ import os import sys import subprocess import unittest -import paddle import tempfile -import paddle.fluid as fluid from paddle.fluid import core diff --git a/python/paddle/fluid/tests/unittests/test_grad_clip_minimize.py b/python/paddle/fluid/tests/unittests/test_grad_clip_minimize.py index 192df0a904e53bdb929c967f0d1a275fffef7ef4..fc8c1c946bbec16d8820515d210088321d445416 100644 --- a/python/paddle/fluid/tests/unittests/test_grad_clip_minimize.py +++ b/python/paddle/fluid/tests/unittests/test_grad_clip_minimize.py @@ -12,14 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contextlib import unittest import numpy as np -import six -import paddle import paddle.fluid as fluid -from paddle.fluid import core from paddle.fluid.dygraph.base import to_variable diff --git a/python/paddle/fluid/tests/unittests/test_gradient_clip.py b/python/paddle/fluid/tests/unittests/test_gradient_clip.py index 6cc2da456aacdd387166c7ad2f3f5d4081b10272..825e84f9f6d9a1646f927c73f1ef7aa72cc23a1f 100644 --- a/python/paddle/fluid/tests/unittests/test_gradient_clip.py +++ b/python/paddle/fluid/tests/unittests/test_gradient_clip.py @@ -17,7 +17,6 @@ import numpy as np import paddle import paddle.fluid.core as core import paddle.fluid as fluid -import six from fake_reader import fake_imdb_reader from paddle.fluid.clip import _allow_pure_fp16_global_norm_clip diff --git a/python/paddle/fluid/tests/unittests/test_graph_reindex.py b/python/paddle/fluid/tests/unittests/test_graph_reindex.py index 668d1525c81a70049a881e68a98e33d9b4fc889e..db1d7d3cff99ebb83f163bf87dab16f1d8e36a35 100644 --- a/python/paddle/fluid/tests/unittests/test_graph_reindex.py +++ b/python/paddle/fluid/tests/unittests/test_graph_reindex.py @@ -15,7 +15,6 @@ import unittest import numpy as np import paddle -import paddle.fluid as fluid class TestGraphReindex(unittest.TestCase): diff --git a/python/paddle/fluid/tests/unittests/test_graph_send_recv_op.py b/python/paddle/fluid/tests/unittests/test_graph_send_recv_op.py index 8fb97ef34875881474869315c8ca81503936cbc6..40d1673438fa72cfd0fbf672b1272fbe06cb1057 100644 --- a/python/paddle/fluid/tests/unittests/test_graph_send_recv_op.py +++ b/python/paddle/fluid/tests/unittests/test_graph_send_recv_op.py @@ -16,7 +16,6 @@ import unittest import numpy as np import paddle -import paddle.fluid as fluid from paddle.fluid.framework import _test_eager_guard from op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/test_graph_send_ue_recv_op.py b/python/paddle/fluid/tests/unittests/test_graph_send_ue_recv_op.py index b2a0adf115fa803aabfb4802de8f5e6d8a2b4aa9..bf74885ba5a4913147412cd264ef825167190600 100644 --- a/python/paddle/fluid/tests/unittests/test_graph_send_ue_recv_op.py +++ b/python/paddle/fluid/tests/unittests/test_graph_send_ue_recv_op.py @@ -16,7 +16,6 @@ import unittest import numpy as np import paddle -import paddle.fluid as fluid import paddle.fluid.core as core from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_graph_send_uv_op.py b/python/paddle/fluid/tests/unittests/test_graph_send_uv_op.py index 7e3ebaeffbe7bceda5432cbccc6df700d69fba77..3ee79f1268b5285a2d3c762c462c5f66edc34944 100644 --- a/python/paddle/fluid/tests/unittests/test_graph_send_uv_op.py +++ b/python/paddle/fluid/tests/unittests/test_graph_send_uv_op.py @@ -15,8 +15,6 @@ import unittest import numpy as np import paddle -import paddle.fluid as fluid -import paddle.fluid.core as core from paddle.fluid.framework import _test_eager_guard from op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/test_grid_sample_function.py b/python/paddle/fluid/tests/unittests/test_grid_sample_function.py index 90e80e013ece1b49cd7a2272b52c430a7a946557..7255f82bc07571695fa6348a3b7ad16e097896d1 100644 --- a/python/paddle/fluid/tests/unittests/test_grid_sample_function.py +++ b/python/paddle/fluid/tests/unittests/test_grid_sample_function.py @@ -14,7 +14,7 @@ import numpy as np import paddle -from paddle import fluid, nn +from paddle import fluid import paddle.fluid.dygraph as dg import paddle.nn.functional as F import unittest diff --git a/python/paddle/fluid/tests/unittests/test_group_norm_op.py b/python/paddle/fluid/tests/unittests/test_group_norm_op.py index 74bc2a803df5bfb990645213f6a47afd00844021..3ae2bf0a391f77ac7aa786d72996e9fa6d080a72 100644 --- a/python/paddle/fluid/tests/unittests/test_group_norm_op.py +++ b/python/paddle/fluid/tests/unittests/test_group_norm_op.py @@ -15,7 +15,6 @@ import unittest import numpy as np -from operator import mul import paddle.fluid.core as core import paddle.fluid as fluid from op_test import OpTest, skip_check_grad_ci diff --git a/python/paddle/fluid/tests/unittests/test_group_norm_op_v2.py b/python/paddle/fluid/tests/unittests/test_group_norm_op_v2.py index 26073401b6858e110ad710a7a7e2938b41e77648..52889f757df72fba9543a7528d1283feb8d38e07 100644 --- a/python/paddle/fluid/tests/unittests/test_group_norm_op_v2.py +++ b/python/paddle/fluid/tests/unittests/test_group_norm_op_v2.py @@ -12,14 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os import unittest import numpy as np import paddle.fluid.core as core -from paddle.fluid.op import Operator import paddle.fluid as fluid -from op_test import OpTest, _set_use_system_allocator -from paddle.fluid.framework import grad_var_name import paddle.fluid as fluid from paddle.fluid import Program, program_guard from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_gru_op.py b/python/paddle/fluid/tests/unittests/test_gru_op.py index a92837be296964cbdb302868f8d45f63e2534ea5..4e51c1da0e8b2f7b0016a870c8ed117930f19ad6 100644 --- a/python/paddle/fluid/tests/unittests/test_gru_op.py +++ b/python/paddle/fluid/tests/unittests/test_gru_op.py @@ -14,9 +14,8 @@ import unittest import numpy as np -import math import functools -from op_test import OpTest, skip_check_grad_ci +from op_test import OpTest from paddle.fluid.tests.unittests.test_lstm_op import ACTIVATION from paddle import fluid from paddle.fluid import Program, program_guard diff --git a/python/paddle/fluid/tests/unittests/test_gru_rnn_op.py b/python/paddle/fluid/tests/unittests/test_gru_rnn_op.py index abce0e112788420b3f6aa4f3cd401ce9e3e6a218..0a10eb74f5511a6ca13ce506adc47f68b58de83a 100644 --- a/python/paddle/fluid/tests/unittests/test_gru_rnn_op.py +++ b/python/paddle/fluid/tests/unittests/test_gru_rnn_op.py @@ -14,13 +14,10 @@ import unittest import numpy as np -import math from op_test import OpTest import paddle import paddle.fluid.core as core -import paddle.fluid as fluid -import paddle.fluid.layers as layers import random import sys diff --git a/python/paddle/fluid/tests/unittests/test_gumbel_softmax_op.py b/python/paddle/fluid/tests/unittests/test_gumbel_softmax_op.py index a411289dcbffd0eb98c5b132dc0bf4eb6f931a63..90de83fce248f88d570ab6ea5efc69724ea4f8b6 100644 --- a/python/paddle/fluid/tests/unittests/test_gumbel_softmax_op.py +++ b/python/paddle/fluid/tests/unittests/test_gumbel_softmax_op.py @@ -13,10 +13,8 @@ import unittest import numpy as np from op_test import OpTest -import paddle.fluid.core as core import paddle import paddle.fluid as fluid -from paddle.fluid import Program, program_guard from paddle.fluid.framework import _test_eager_guard paddle.enable_static() diff --git a/python/paddle/fluid/tests/unittests/test_histogram_op.py b/python/paddle/fluid/tests/unittests/test_histogram_op.py index 321fbfbabfd7c5ff7ab358f034656aecb01c5fd7..725b6c02362010fbe523c7a57608b79eedc40452 100644 --- a/python/paddle/fluid/tests/unittests/test_histogram_op.py +++ b/python/paddle/fluid/tests/unittests/test_histogram_op.py @@ -16,7 +16,6 @@ import unittest import numpy as np import paddle import paddle.fluid as fluid -import paddle.fluid.core as core from paddle.fluid import Program, program_guard from op_test import OpTest from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_hsigmoid_op.py b/python/paddle/fluid/tests/unittests/test_hsigmoid_op.py index 22b6e286268f16cc399a53d9d9734d4a050d57d1..66cb6ac427a543a840e6e0168c74fde63de2f3b0 100644 --- a/python/paddle/fluid/tests/unittests/test_hsigmoid_op.py +++ b/python/paddle/fluid/tests/unittests/test_hsigmoid_op.py @@ -15,7 +15,6 @@ import unittest import numpy as np import paddle -import paddle.fluid.core as core import paddle.fluid as fluid import paddle.nn.functional as F from paddle.fluid import Program, program_guard diff --git a/python/paddle/fluid/tests/unittests/test_huber_loss_op.py b/python/paddle/fluid/tests/unittests/test_huber_loss_op.py index 035fee7b4ea969d8481a2a377e706732c2a0c904..d679d2b719f430c80596ade173b8c63065e66347 100644 --- a/python/paddle/fluid/tests/unittests/test_huber_loss_op.py +++ b/python/paddle/fluid/tests/unittests/test_huber_loss_op.py @@ -17,7 +17,7 @@ import numpy as np from op_test import OpTest import paddle.fluid as fluid import paddle -from paddle.fluid import compiler, Program, program_guard +from paddle.fluid import Program, program_guard def huber_loss_forward(val, delta): diff --git a/python/paddle/fluid/tests/unittests/test_hybrid_parallel_topology.py b/python/paddle/fluid/tests/unittests/test_hybrid_parallel_topology.py index 926d31098a47255834fefd0446a4bc3f3f0405b1..00b1f10ede850269d1255540b1cfee8995d232da 100644 --- a/python/paddle/fluid/tests/unittests/test_hybrid_parallel_topology.py +++ b/python/paddle/fluid/tests/unittests/test_hybrid_parallel_topology.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle -import paddle.nn as nn import unittest from paddle.distributed import fleet import numpy as np diff --git a/python/paddle/fluid/tests/unittests/test_identity_loss_op.py b/python/paddle/fluid/tests/unittests/test_identity_loss_op.py index 6f500aaa623ffdba3bd9fccf6e4394e4b4acfdb6..de81c16da7dfab737a5881275de2234bb6dbc83d 100644 --- a/python/paddle/fluid/tests/unittests/test_identity_loss_op.py +++ b/python/paddle/fluid/tests/unittests/test_identity_loss_op.py @@ -18,7 +18,6 @@ import paddle import paddle.fluid as fluid from paddle.fluid import Program, program_guard from op_test import OpTest -from paddle.fluid.framework import _test_eager_guard class TestIdentityLossOp(OpTest): diff --git a/python/paddle/fluid/tests/unittests/test_identity_op.py b/python/paddle/fluid/tests/unittests/test_identity_op.py index c4ab579182881588c4fc3aca8d77529db687d20f..f257db187eba67264c76ab8508c6ede6fcb64c3d 100644 --- a/python/paddle/fluid/tests/unittests/test_identity_op.py +++ b/python/paddle/fluid/tests/unittests/test_identity_op.py @@ -14,8 +14,6 @@ import unittest import numpy as np -import paddle.fluid as fluid -import paddle.fluid.core as core import paddle diff --git a/python/paddle/fluid/tests/unittests/test_imperative_base.py b/python/paddle/fluid/tests/unittests/test_imperative_base.py index 1dd5348a8852d78fde73ab9ddf9d0015e903cb3f..d882bb772c604d5eae5848f8646d6f80bff77604 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_base.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_base.py @@ -13,11 +13,8 @@ # limitations under the License. import contextlib -import unittest -import numpy as np import paddle.fluid as fluid -from paddle.fluid import core @contextlib.contextmanager diff --git a/python/paddle/fluid/tests/unittests/test_imperative_basic.py b/python/paddle/fluid/tests/unittests/test_imperative_basic.py index 452d8e726725454e1b552f60f81c901d41952819..3c8088a1055574c0732827c72b1fae52e9b714b8 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_basic.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_basic.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contextlib import unittest import numpy as np @@ -24,7 +23,7 @@ from test_imperative_base import new_program_scope import paddle.fluid.dygraph_utils as dygraph_utils from paddle.fluid.dygraph.layer_object_helper import LayerObjectHelper import paddle -from paddle.fluid.framework import _test_eager_guard, _in_legacy_dygraph, _non_static_mode +from paddle.fluid.framework import _in_legacy_dygraph, _test_eager_guard class MyLayer(fluid.Layer): diff --git a/python/paddle/fluid/tests/unittests/test_imperative_container_layerdict.py b/python/paddle/fluid/tests/unittests/test_imperative_container_layerdict.py index 34050b5bf74d20f050308bd7936944d7f9b1c213..2e7bd103ec501d00d3b0b485c3deb91f4dd9616d 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_container_layerdict.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_container_layerdict.py @@ -13,7 +13,6 @@ # limitations under the License. import unittest -import numpy as np import paddle from collections import OrderedDict from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_imperative_container_parameterlist.py b/python/paddle/fluid/tests/unittests/test_imperative_container_parameterlist.py index 3deada01f4a09d8cc5b340582ed2ba1ba3af8dd9..2101e84858ab8e087de3248a8602bc6453279a67 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_container_parameterlist.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_container_parameterlist.py @@ -16,7 +16,7 @@ import unittest import paddle.fluid as fluid import numpy as np import paddle -from paddle import _C_ops, _legacy_C_ops +from paddle import _legacy_C_ops from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_imperative_data_loader_base.py b/python/paddle/fluid/tests/unittests/test_imperative_data_loader_base.py index 4ef5f423d4d76136c88254b3268dcc3769ad23fa..5ae1b3f00144c649d9b6f55565dcc40c10de9488 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_data_loader_base.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_data_loader_base.py @@ -12,11 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys import unittest import numpy as np import paddle.fluid as fluid -from paddle.fluid import core from paddle.fluid.reader import use_pinned_memory from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_imperative_data_loader_exception.py b/python/paddle/fluid/tests/unittests/test_imperative_data_loader_exception.py index 034d38c4e8ae3117367f9c6628f0e57ebc7d9a1c..4cc6d813bf871ce18c8424d1635cba97f2cd5e99 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_data_loader_exception.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_data_loader_exception.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys import time import unittest import numpy as np diff --git a/python/paddle/fluid/tests/unittests/test_imperative_data_loader_exit_func.py b/python/paddle/fluid/tests/unittests/test_imperative_data_loader_exit_func.py index f50c1e912fb795f26be56a19521832caa62f0164..8c201d85a9cdd82d63e6df021f24118ff0ce1bea 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_data_loader_exit_func.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_data_loader_exit_func.py @@ -36,7 +36,6 @@ class TestDygraphDataLoaderCleanUpFunc(unittest.TestCase): def func_test_clear_queue_set(self): test_queue = queue.Queue(self.capacity) - global multiprocess_queue_set multiprocess_queue_set.add(test_queue) for i in range(0, self.capacity): test_queue.put(i) diff --git a/python/paddle/fluid/tests/unittests/test_imperative_data_loader_fds_clear.py b/python/paddle/fluid/tests/unittests/test_imperative_data_loader_fds_clear.py index bb7bb89d781b826bdc632f69e3933cac0cf4feb2..f0bdc8dacba9ae62ad1311c121d6116e537fe41d 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_data_loader_fds_clear.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_data_loader_fds_clear.py @@ -12,11 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys import unittest import numpy as np import paddle.fluid as fluid -from paddle.fluid import core from paddle.io import Dataset, DataLoader from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_imperative_data_loader_process.py b/python/paddle/fluid/tests/unittests/test_imperative_data_loader_process.py index 0f1be02f373beae5781d87d19e0958e103b49eee..9d4b69535411c1322e7e74be18af3e60998dc7fd 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_data_loader_process.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_data_loader_process.py @@ -17,7 +17,6 @@ import unittest import multiprocessing import numpy as np import paddle.fluid as fluid -from paddle.fluid import core from paddle.fluid.reader import _reader_process_loop from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_imperative_data_parallel.py b/python/paddle/fluid/tests/unittests/test_imperative_data_parallel.py index 7b703c8d2f1ad3a8e238ba0fac08fa47c8bdd569..4d61d2a67fd87f4b551eb9b46d907330d27cc5a2 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_data_parallel.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_data_parallel.py @@ -12,13 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contextlib import unittest import numpy as np -import six import unittest -import paddle import paddle.fluid as fluid import paddle.fluid.dygraph as dygraph from paddle.fluid.dygraph.nn import Linear diff --git a/python/paddle/fluid/tests/unittests/test_imperative_double_grad.py b/python/paddle/fluid/tests/unittests/test_imperative_double_grad.py index d71d2aba63dde45ed44814941b7ab2ad7e678456..ae1fe6d3706663cdaa9912c3a91a37ee738b6992 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_double_grad.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_double_grad.py @@ -20,8 +20,7 @@ import unittest from unittest import TestCase import numpy as np import paddle.compat as cpt -from paddle.fluid.framework import _test_eager_guard, _in_legacy_dygraph, _in_eager_without_dygraph_check -import paddle.fluid.core as core +from paddle.fluid.framework import _test_eager_guard def _dygraph_guard_(func): diff --git a/python/paddle/fluid/tests/unittests/test_imperative_gan.py b/python/paddle/fluid/tests/unittests/test_imperative_gan.py index 3a52bcc1ead581083c95661d19467cf2d653b8c7..b2a815c6d5f5369ceb08883e05f05cc2b0c98ff4 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_gan.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_gan.py @@ -12,17 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contextlib import unittest import numpy as np import six -import sys import paddle import paddle.fluid as fluid import paddle.fluid.core as core from paddle.fluid.optimizer import SGDOptimizer -from paddle.fluid import Conv2D, Pool2D, Linear +from paddle.fluid import Linear from test_imperative_base import new_program_scope from paddle.fluid.dygraph.base import to_variable from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_imperative_gnn.py b/python/paddle/fluid/tests/unittests/test_imperative_gnn.py index 721ce8972101a397fc98f4c6b4b3e74f98bba1b6..f001e7c4e0c6c064b0cceed851d08c9d2ed1a271 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_gnn.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_gnn.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contextlib import unittest import numpy as np import sys diff --git a/python/paddle/fluid/tests/unittests/test_imperative_group.py b/python/paddle/fluid/tests/unittests/test_imperative_group.py index 4080d38ea4b628b9eb4f802c0335388dc02a45ec..f67592312c84a01caeea0dbd5c925c0828775abb 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_group.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_group.py @@ -12,18 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contextlib import unittest -import numpy as np -import six import unittest import paddle -import paddle.fluid as fluid -import paddle.fluid.dygraph as dygraph -from paddle.fluid.dygraph.nn import Linear import paddle.fluid.core as core -from paddle.fluid.optimizer import SGDOptimizer from paddle.fluid.framework import _test_eager_guard, _in_legacy_dygraph, in_dygraph_mode diff --git a/python/paddle/fluid/tests/unittests/test_imperative_hook_for_layer.py b/python/paddle/fluid/tests/unittests/test_imperative_hook_for_layer.py index 3dd48601b116eb102be5e1b7ec681185dc5b19c7..1f60bf20e09c8c41735e9af39a3dc6ff859befc5 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_hook_for_layer.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_hook_for_layer.py @@ -12,12 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contextlib import unittest import numpy as np -import six -import paddle import paddle.fluid as fluid import paddle.fluid.core as core import paddle.fluid.dygraph.base as base diff --git a/python/paddle/fluid/tests/unittests/test_imperative_layers.py b/python/paddle/fluid/tests/unittests/test_imperative_layers.py index 4f7e8c1ac1672fb1351564c8356a98ab7704c11f..e2b9855af41c10a567d226bbb8b9e4ffcae262d1 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_layers.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_layers.py @@ -13,9 +13,8 @@ # limitations under the License. import unittest -import paddle import paddle.nn as nn -from paddle.fluid.framework import _test_eager_guard, _non_static_mode +from paddle.fluid.framework import _test_eager_guard class TestLayerPrint(unittest.TestCase): diff --git a/python/paddle/fluid/tests/unittests/test_imperative_lod_tensor_to_selected_rows.py b/python/paddle/fluid/tests/unittests/test_imperative_lod_tensor_to_selected_rows.py index 7e4a706c8a87b8d19e297a3b1d5b20c2ea32a6c9..ddd403b0f603219035b1150e57f2e69af1fe80ac 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_lod_tensor_to_selected_rows.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_lod_tensor_to_selected_rows.py @@ -17,7 +17,6 @@ import paddle import paddle.fluid as fluid import paddle.fluid.core as core from paddle.fluid.dygraph.nn import Embedding -import paddle.fluid.framework as framework from paddle.fluid.optimizer import SGDOptimizer from paddle.fluid.dygraph.base import to_variable from test_imperative_base import new_program_scope diff --git a/python/paddle/fluid/tests/unittests/test_imperative_mnist.py b/python/paddle/fluid/tests/unittests/test_imperative_mnist.py index 5813ff595c2f6a7b14921acc3856296495b2901b..b4178028521ad4408ef736f4cde2d3126f00dabc 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_mnist.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_mnist.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contextlib import unittest import numpy as np import six @@ -22,9 +21,8 @@ import paddle.fluid as fluid from paddle.fluid import core from paddle.fluid.optimizer import SGDOptimizer from paddle.fluid.dygraph.nn import Conv2D, Pool2D, Linear -from paddle.fluid.dygraph.base import to_variable from test_imperative_base import new_program_scope -from utils import DyGraphProgramDescTracerTestHelper, is_equal_program +from utils import DyGraphProgramDescTracerTestHelper from paddle.fluid.framework import _test_eager_guard, _in_legacy_dygraph diff --git a/python/paddle/fluid/tests/unittests/test_imperative_mnist_sorted_gradient.py b/python/paddle/fluid/tests/unittests/test_imperative_mnist_sorted_gradient.py index 89e5ab034089d5b2ffdbe57ca0c6852d0a77f62b..80d63921d361ba2fd4112cef2fcb4c22c62c2d70 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_mnist_sorted_gradient.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_mnist_sorted_gradient.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contextlib import unittest import numpy as np import six diff --git a/python/paddle/fluid/tests/unittests/test_imperative_named_members.py b/python/paddle/fluid/tests/unittests/test_imperative_named_members.py index c3b052edeace00bb20f9fcb32b5ff7ac9397ff60..57fad812bf8eca2f6178640ae820263b8856393a 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_named_members.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_named_members.py @@ -16,7 +16,7 @@ import unittest import numpy as np import paddle.fluid as fluid import paddle -from paddle.fluid.framework import _test_eager_guard, _non_static_mode +from paddle.fluid.framework import _test_eager_guard class MyLayer(fluid.Layer): diff --git a/python/paddle/fluid/tests/unittests/test_imperative_optimizer.py b/python/paddle/fluid/tests/unittests/test_imperative_optimizer.py index 370a009474a62c16a0015f24c67151bd367bf49a..3c078ffbde5cb859c872764518363e8a7f1e0b94 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_optimizer.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_optimizer.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contextlib import unittest import numpy as np import six @@ -24,7 +23,6 @@ from paddle.fluid import core from paddle.fluid.optimizer import SGDOptimizer, Adam, MomentumOptimizer, LarsMomentumOptimizer, AdagradOptimizer, AdamaxOptimizer, DpsgdOptimizer, DecayedAdagradOptimizer, AdadeltaOptimizer, RMSPropOptimizer, FtrlOptimizer, LambOptimizer from paddle.fluid.optimizer import ModelAverage, DGCMomentumOptimizer, ExponentialMovingAverage, PipelineOptimizer, LookaheadOptimizer, RecomputeOptimizer from paddle.fluid.dygraph import Linear -from paddle.fluid.dygraph.base import to_variable from test_imperative_base import new_program_scope from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_imperative_optimizer_v2.py b/python/paddle/fluid/tests/unittests/test_imperative_optimizer_v2.py index ba953d2762a880912c77b2e774fc3b77fbab1b66..f8446d22ff766cb53f8e9c7733f109badcc4cf45 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_optimizer_v2.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_optimizer_v2.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contextlib import unittest import numpy as np import six @@ -24,7 +23,6 @@ from paddle.fluid import core from paddle.fluid.optimizer import MomentumOptimizer, LarsMomentumOptimizer, AdagradOptimizer, AdamaxOptimizer, DpsgdOptimizer, DecayedAdagradOptimizer, AdadeltaOptimizer, RMSPropOptimizer, FtrlOptimizer from paddle.fluid.optimizer import ModelAverage, DGCMomentumOptimizer, ExponentialMovingAverage, PipelineOptimizer, LookaheadOptimizer, RecomputeOptimizer from paddle.fluid.dygraph import Linear -from paddle.fluid.dygraph.base import to_variable from test_imperative_base import new_program_scope from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_imperative_parallel_coalesce_split.py b/python/paddle/fluid/tests/unittests/test_imperative_parallel_coalesce_split.py index 54da2becfde4802b35c188882c08f27590026e27..7c6d13399c0e08ad14dc551fb4f410997749c99b 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_parallel_coalesce_split.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_parallel_coalesce_split.py @@ -12,12 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contextlib import unittest import numpy as np from collections import OrderedDict -import paddle import paddle.fluid as fluid from paddle.fluid import core from paddle.fluid.dygraph.parallel import DataParallel diff --git a/python/paddle/fluid/tests/unittests/test_imperative_ptb_rnn_sorted_gradient.py b/python/paddle/fluid/tests/unittests/test_imperative_ptb_rnn_sorted_gradient.py index 93890a2aaa8448cef0c7beb36e730afced8ac31f..2422383bbded3c0b5afaeaed4c1dfddf02e1d970 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_ptb_rnn_sorted_gradient.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_ptb_rnn_sorted_gradient.py @@ -16,7 +16,6 @@ import unittest import paddle import paddle.fluid as fluid import paddle.fluid.core as core -from paddle.fluid.dygraph.nn import Embedding import paddle.fluid.framework as framework from paddle.fluid.optimizer import SGDOptimizer from paddle.fluid.dygraph.base import to_variable diff --git a/python/paddle/fluid/tests/unittests/test_imperative_recurrent_usage.py b/python/paddle/fluid/tests/unittests/test_imperative_recurrent_usage.py index 72794390bf4cdf898aa6fadb596b56a70ca2c207..622d174eefcc0004794757548ed4e6a02a0fa8c2 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_recurrent_usage.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_recurrent_usage.py @@ -16,14 +16,10 @@ import unittest import paddle.fluid as fluid import paddle import paddle.fluid.core as core -from paddle.fluid.dygraph.nn import Embedding -import paddle.fluid.framework as framework from paddle.fluid.framework import _test_eager_guard -from paddle.fluid.optimizer import SGDOptimizer from paddle.fluid.dygraph.base import to_variable from test_imperative_base import new_program_scope import numpy as np -import six class RecurrentTest(fluid.Layer): diff --git a/python/paddle/fluid/tests/unittests/test_imperative_reinforcement.py b/python/paddle/fluid/tests/unittests/test_imperative_reinforcement.py index e0802b0202a43e9e12fd05afed0945a009082791..2e72413673d92f7187c9e2affd5a55413b35519f 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_reinforcement.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_reinforcement.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contextlib import unittest import numpy as np import six @@ -21,9 +20,7 @@ import paddle import paddle.fluid as fluid from paddle.fluid import core from paddle.fluid.optimizer import SGDOptimizer -from paddle.fluid.dygraph.nn import Conv2D, Pool2D, Linear import paddle.fluid.dygraph.nn as nn -from paddle.fluid.dygraph.base import to_variable from test_imperative_base import new_program_scope from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_imperative_resnet.py b/python/paddle/fluid/tests/unittests/test_imperative_resnet.py index 2f266c384582de8d0edfc619202097b8839229eb..27a56884462e85bd53293b473bf5fbaef963805e 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_resnet.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_resnet.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contextlib import unittest import numpy as np import six diff --git a/python/paddle/fluid/tests/unittests/test_imperative_save_load.py b/python/paddle/fluid/tests/unittests/test_imperative_save_load.py index d93c8fe9b4edff86a043d5533b4194be41b90499..7933d4f15456ee0cc30d1ebbb8bf304bdbade316 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_save_load.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_save_load.py @@ -16,14 +16,11 @@ import os import unittest import paddle.fluid as fluid import paddle.fluid.core as core -from paddle.fluid.dygraph.nn import Embedding, Linear -import paddle.fluid.framework as framework +from paddle.fluid.dygraph.nn import Embedding from paddle.fluid.optimizer import Adam from paddle.fluid.dygraph.base import to_variable from paddle.fluid.dygraph.learning_rate_scheduler import LearningRateDecay -from test_imperative_base import new_program_scope import numpy as np -import six import paddle from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_imperative_save_load_v2.py b/python/paddle/fluid/tests/unittests/test_imperative_save_load_v2.py index 37f5760d2da13bd8f5eb2bd7f9127fa36c7ab80f..0e051381adf7194fad1792f5ce9cdcf2f1dd9317 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_save_load_v2.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_save_load_v2.py @@ -16,14 +16,11 @@ import os import unittest import paddle.fluid as fluid import paddle.fluid.core as core -from paddle.fluid.dygraph.nn import Embedding, Linear -import paddle.fluid.framework as framework +from paddle.fluid.dygraph.nn import Embedding from paddle.optimizer import Adam from paddle.fluid.dygraph.base import to_variable from paddle.fluid.dygraph.learning_rate_scheduler import LearningRateDecay -from test_imperative_base import new_program_scope import numpy as np -import six import paddle from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_imperative_se_resnext.py b/python/paddle/fluid/tests/unittests/test_imperative_se_resnext.py index aa73e0412f740c51b5ebf1d1d2bc4eb53d122191..dfae761553df5d0d47d859483e9483f64e194781 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_se_resnext.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_se_resnext.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contextlib import unittest import numpy as np import six @@ -22,7 +21,6 @@ import paddle.fluid as fluid from paddle.fluid import core from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.dygraph.nn import Conv2D, Pool2D, BatchNorm, Linear -from paddle.fluid.dygraph.base import to_variable from test_imperative_base import new_program_scope from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_imperative_selected_rows.py b/python/paddle/fluid/tests/unittests/test_imperative_selected_rows.py index 5a5017a73b427f0ef4aab07ce5667c0c9c17b03c..602d2e07ce55eb31cde5e2a8db6cfd27e040f528 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_selected_rows.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_selected_rows.py @@ -15,7 +15,6 @@ import unittest import paddle.fluid as fluid from paddle.fluid.dygraph.base import to_variable -from paddle.fluid.dygraph.nn import Embedding from paddle.fluid.optimizer import SGDOptimizer import numpy as np import paddle.fluid.core as core diff --git a/python/paddle/fluid/tests/unittests/test_imperative_star_gan_with_gradient_penalty.py b/python/paddle/fluid/tests/unittests/test_imperative_star_gan_with_gradient_penalty.py index 5b08c6167925e7e7ecf9606b7ae6aac4f61ae103..4b394ba87fdd1ea534697ae5f8759092b9544739 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_star_gan_with_gradient_penalty.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_star_gan_with_gradient_penalty.py @@ -16,8 +16,8 @@ import paddle import paddle.fluid as fluid import numpy as np import unittest -from paddle import _C_ops, _legacy_C_ops -from paddle.fluid.framework import _test_eager_guard, _in_legacy_dygraph, _in_eager_without_dygraph_check +from paddle import _legacy_C_ops +from paddle.fluid.framework import _test_eager_guard if fluid.is_compiled_with_cuda(): fluid.core.globals()['FLAGS_cudnn_deterministic'] = True diff --git a/python/paddle/fluid/tests/unittests/test_imperative_static_runner_mnist.py b/python/paddle/fluid/tests/unittests/test_imperative_static_runner_mnist.py index aaa3f32ecf578de9a6f0bdb48e1b6cda6a059634..ff076d836f868169b60e5099bbd76563219ae6f5 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_static_runner_mnist.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_static_runner_mnist.py @@ -14,16 +14,13 @@ import unittest -import contextlib import numpy as np import six import paddle import paddle.fluid as fluid from paddle.fluid import core -from paddle.fluid import unique_name from test_imperative_base import new_program_scope -from jit_load_rename_var import rename_var_with_generator LOADED_VAR_SUFFIX = ".load_0" diff --git a/python/paddle/fluid/tests/unittests/test_imperative_static_runner_while.py b/python/paddle/fluid/tests/unittests/test_imperative_static_runner_while.py index f865a06b4932f1b97ea16b9c7ea7e9d9c9d7f05c..f6ebc0b394a26a5c9529bddc3b5db88051d44de1 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_static_runner_while.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_static_runner_while.py @@ -14,7 +14,6 @@ import unittest -import contextlib import numpy as np import six @@ -25,8 +24,6 @@ from paddle.fluid import unique_name from test_imperative_base import new_program_scope from jit_load_rename_var import rename_var_with_generator -import paddle.fluid.transpiler.details.program_utils as pu - LOADED_VAR_SUFFIX = ".load_0" diff --git a/python/paddle/fluid/tests/unittests/test_imperative_transformer_sorted_gradient.py b/python/paddle/fluid/tests/unittests/test_imperative_transformer_sorted_gradient.py index 51eb793c8e7d3a7c44162034d65a7ad28407ccb3..090384bec805d9dcf8989ea0af491fdddc402b42 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_transformer_sorted_gradient.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_transformer_sorted_gradient.py @@ -19,7 +19,7 @@ from paddle.fluid import Embedding, LayerNorm, Linear, Layer from paddle.fluid.dygraph import to_variable, guard from paddle.fluid.dygraph import TracedLayer from test_imperative_base import new_program_scope -from paddle.fluid.framework import _test_eager_guard, in_dygraph_mode, _in_legacy_dygraph +from paddle.fluid.framework import _in_legacy_dygraph, _test_eager_guard from paddle.fluid import core import numpy as np import six diff --git a/python/paddle/fluid/tests/unittests/test_imperative_triple_grad.py b/python/paddle/fluid/tests/unittests/test_imperative_triple_grad.py index fab9313048f6ff6e5333ee0da25d51e783508155..7f0ea807271bec02bffab980256adbedc0eed341 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_triple_grad.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_triple_grad.py @@ -15,11 +15,10 @@ import paddle.fluid as fluid import paddle from paddle.fluid.wrapped_decorator import wrap_decorator -from paddle.vision.models import resnet50, resnet101 import unittest from unittest import TestCase import numpy as np -from paddle.fluid.framework import _test_eager_guard, _in_legacy_dygraph, _in_eager_without_dygraph_check +from paddle.fluid.framework import _test_eager_guard def _dygraph_guard_(func): diff --git a/python/paddle/fluid/tests/unittests/test_index_add_op.py b/python/paddle/fluid/tests/unittests/test_index_add_op.py index 95385d33b886a35a5723a5d66c4d8eacc3145e50..f3b799f0d3501a94f81352640bd9dcc34be0a49e 100644 --- a/python/paddle/fluid/tests/unittests/test_index_add_op.py +++ b/python/paddle/fluid/tests/unittests/test_index_add_op.py @@ -15,10 +15,8 @@ import unittest import paddle import numpy as np -import paddle.fluid.core as core from op_test import OpTest -import paddle.fluid as fluid -from paddle.fluid import Program, program_guard +from paddle.fluid import Program def compute_index_add_ref(axis, x_shape, x_np, add_value_shape, add_value_np, diff --git a/python/paddle/fluid/tests/unittests/test_index_select_op.py b/python/paddle/fluid/tests/unittests/test_index_select_op.py index dd45d130d00286231c2aaf6e3d857cd6863216f8..2d73a29e2c936f200a0680520a9095751b3f82fc 100644 --- a/python/paddle/fluid/tests/unittests/test_index_select_op.py +++ b/python/paddle/fluid/tests/unittests/test_index_select_op.py @@ -15,7 +15,6 @@ import unittest import paddle import numpy as np -import paddle.fluid.core as core from op_test import OpTest import paddle.fluid as fluid from paddle.fluid import Program, program_guard diff --git a/python/paddle/fluid/tests/unittests/test_infer_no_need_buffer_slots.py b/python/paddle/fluid/tests/unittests/test_infer_no_need_buffer_slots.py index 8935a8aa370d8963bbe15d404f03ab87cac12e4e..51f6cd53ca37654e850f43e8587b351a4576742c 100644 --- a/python/paddle/fluid/tests/unittests/test_infer_no_need_buffer_slots.py +++ b/python/paddle/fluid/tests/unittests/test_infer_no_need_buffer_slots.py @@ -16,7 +16,6 @@ import unittest import paddle.fluid as fluid import paddle.fluid.framework as framework -import paddle.compat as cpt import paddle.fluid.core as core diff --git a/python/paddle/fluid/tests/unittests/test_inference_api.py b/python/paddle/fluid/tests/unittests/test_inference_api.py index a590dcecbfe0e20e28c1008eb83a7cd341cdd4ef..27ddf815aa0d09fca4083386bfc0dea56bcd75d9 100644 --- a/python/paddle/fluid/tests/unittests/test_inference_api.py +++ b/python/paddle/fluid/tests/unittests/test_inference_api.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os, shutil import unittest import paddle @@ -21,7 +20,7 @@ import numpy as np import paddle.fluid as fluid from paddle.fluid.core import PaddleTensor from paddle.fluid.core import PaddleDType -from paddle.inference import Config, Predictor, create_predictor +from paddle.inference import Config, create_predictor from paddle.inference import get_trt_compile_version, get_trt_runtime_version diff --git a/python/paddle/fluid/tests/unittests/test_inference_model_io.py b/python/paddle/fluid/tests/unittests/test_inference_model_io.py index 4185c621b5e491dc9d70d238fb9dd2456c821b7d..c901dd472ec3136d0464ff45d8181156d0309f53 100644 --- a/python/paddle/fluid/tests/unittests/test_inference_model_io.py +++ b/python/paddle/fluid/tests/unittests/test_inference_model_io.py @@ -29,7 +29,6 @@ import paddle.fluid.optimizer as optimizer from paddle.fluid.compiler import CompiledProgram from paddle.fluid.framework import Program, program_guard from paddle.fluid.io import save_inference_model, load_inference_model, save_persistables -from paddle.fluid.transpiler import memory_optimize paddle.enable_static() diff --git a/python/paddle/fluid/tests/unittests/test_inner.py b/python/paddle/fluid/tests/unittests/test_inner.py index d0e28404944bf058d06b8954f5e3c9f1a7aa8609..cf631101e8ee8a6552f87f038ef81561ab7b5fed 100644 --- a/python/paddle/fluid/tests/unittests/test_inner.py +++ b/python/paddle/fluid/tests/unittests/test_inner.py @@ -18,7 +18,7 @@ import numpy as np import paddle from paddle.static import Program, program_guard -from paddle.fluid.framework import _test_eager_guard, in_dygraph_mode +from paddle.fluid.framework import _test_eager_guard class TestMultiplyApi(unittest.TestCase): diff --git a/python/paddle/fluid/tests/unittests/test_inplace.py b/python/paddle/fluid/tests/unittests/test_inplace.py index 37a45b542ebf43f1519822ab16eabbd9bc33d2ab..0d88a35ff2453ab57600c9ed9b7d926dad461273 100644 --- a/python/paddle/fluid/tests/unittests/test_inplace.py +++ b/python/paddle/fluid/tests/unittests/test_inplace.py @@ -16,8 +16,7 @@ import unittest import numpy as np import paddle -import paddle.fluid.core as core -from paddle.fluid.framework import _test_eager_guard, in_dygraph_mode +from paddle.fluid.framework import _test_eager_guard class TestInplace(unittest.TestCase): diff --git a/python/paddle/fluid/tests/unittests/test_inplace_abn_op.py b/python/paddle/fluid/tests/unittests/test_inplace_abn_op.py index cf32476fbf492a2b9f2499da53628e0e3879ea3c..998480a9193ded0437b3a70402dcd1ee0d05f047 100644 --- a/python/paddle/fluid/tests/unittests/test_inplace_abn_op.py +++ b/python/paddle/fluid/tests/unittests/test_inplace_abn_op.py @@ -15,12 +15,9 @@ import unittest import numpy as np import os -import six import paddle.fluid.core as core import paddle.fluid as fluid -from paddle.fluid.layer_helper import LayerHelper from paddle.fluid import compiler -import paddle.fluid.unique_name as unique_name import paddle diff --git a/python/paddle/fluid/tests/unittests/test_inplace_addto_strategy.py b/python/paddle/fluid/tests/unittests/test_inplace_addto_strategy.py index d954304b8dfc25c64c17751b17b0fbbdbc838dd2..825fcbd0620c3745b6d256fe7aff929fbd1b857e 100644 --- a/python/paddle/fluid/tests/unittests/test_inplace_addto_strategy.py +++ b/python/paddle/fluid/tests/unittests/test_inplace_addto_strategy.py @@ -16,8 +16,6 @@ import unittest import paddle import paddle.fluid as fluid -import paddle.fluid.layers as layers -from paddle.fluid.backward import calc_gradient import numpy as np diff --git a/python/paddle/fluid/tests/unittests/test_inplace_and_clear_gradient.py b/python/paddle/fluid/tests/unittests/test_inplace_and_clear_gradient.py index 58a35a71199e8b17c42dccc598cf581e19e1c5e5..7f4bf6a5fefb7d5cb22b394dcb21a0b9a3a65d22 100644 --- a/python/paddle/fluid/tests/unittests/test_inplace_and_clear_gradient.py +++ b/python/paddle/fluid/tests/unittests/test_inplace_and_clear_gradient.py @@ -14,8 +14,7 @@ import numpy as np import paddle -import paddle.fluid as fluid -from paddle import _C_ops, _legacy_C_ops +from paddle import _legacy_C_ops import unittest paddle.disable_static() diff --git a/python/paddle/fluid/tests/unittests/test_inplace_auto_generated_apis.py b/python/paddle/fluid/tests/unittests/test_inplace_auto_generated_apis.py index eef8318bf37155564504f5ee882f24326d357cc5..09e8c6112367746e9a8511a3761b4b0b5dc2805d 100644 --- a/python/paddle/fluid/tests/unittests/test_inplace_auto_generated_apis.py +++ b/python/paddle/fluid/tests/unittests/test_inplace_auto_generated_apis.py @@ -15,9 +15,7 @@ import unittest import numpy as np -from op_test import OpTest import paddle -import paddle.fluid as fluid from paddle.static import Program, program_guard diff --git a/python/paddle/fluid/tests/unittests/test_inplace_softmax_with_cross_entropy.py b/python/paddle/fluid/tests/unittests/test_inplace_softmax_with_cross_entropy.py index 643ff14b878829c08c30655ece71f4fdc088a44b..759454a2887fc170edcc4799162ef362fc302f8e 100644 --- a/python/paddle/fluid/tests/unittests/test_inplace_softmax_with_cross_entropy.py +++ b/python/paddle/fluid/tests/unittests/test_inplace_softmax_with_cross_entropy.py @@ -12,9 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle import paddle.fluid as fluid -from paddle.fluid import layers import numpy as np import unittest diff --git a/python/paddle/fluid/tests/unittests/test_input_spec.py b/python/paddle/fluid/tests/unittests/test_input_spec.py index 79f8bd1ebde78ed490e2ea05357df497cec84d76..bb31c4e7f51e6cddaec7363ffed7dffb7ce8bb96 100644 --- a/python/paddle/fluid/tests/unittests/test_input_spec.py +++ b/python/paddle/fluid/tests/unittests/test_input_spec.py @@ -20,7 +20,7 @@ import numpy as np import paddle import paddle.fluid as fluid from paddle.static import InputSpec -from paddle.fluid.framework import core, convert_np_dtype_to_dtype_ +from paddle.fluid.framework import convert_np_dtype_to_dtype_ from paddle.fluid.dygraph.dygraph_to_static.utils import _compatible_non_tensor_spec diff --git a/python/paddle/fluid/tests/unittests/test_instance_norm_op.py b/python/paddle/fluid/tests/unittests/test_instance_norm_op.py index 23f1ff981f320647c93624d664c5babd467f3c4f..88bed96b35203281dae6227fc6c70dbd765b2f6e 100644 --- a/python/paddle/fluid/tests/unittests/test_instance_norm_op.py +++ b/python/paddle/fluid/tests/unittests/test_instance_norm_op.py @@ -17,8 +17,6 @@ import numpy as np import paddle import paddle.fluid.core as core import paddle.fluid as fluid -from paddle.fluid.op import Operator -from op_test import OpTest from paddle.fluid import Program, program_guard from paddle.fluid.dygraph import to_variable from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_instance_norm_op_v2.py b/python/paddle/fluid/tests/unittests/test_instance_norm_op_v2.py index 28560cccec17fd9be0e9084e7fcf8cb41e165e9b..cbb91795a50052e18f8d3abd72535dfc7c867b4b 100644 --- a/python/paddle/fluid/tests/unittests/test_instance_norm_op_v2.py +++ b/python/paddle/fluid/tests/unittests/test_instance_norm_op_v2.py @@ -12,14 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os import unittest import numpy as np import paddle.fluid.core as core -from paddle.fluid.op import Operator import paddle.fluid as fluid -from op_test import OpTest, _set_use_system_allocator -from paddle.fluid.framework import grad_var_name import paddle.fluid as fluid from paddle.fluid import Program, program_guard from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_inverse_op.py b/python/paddle/fluid/tests/unittests/test_inverse_op.py index ec0a94c3c04df78723886da1273cca01550282d1..b155df0498d093a2e632a0dfa21c94a753bb8408 100644 --- a/python/paddle/fluid/tests/unittests/test_inverse_op.py +++ b/python/paddle/fluid/tests/unittests/test_inverse_op.py @@ -179,10 +179,8 @@ class TestInverseSingularAPI(unittest.TestCase): fetch_list=[result]) except RuntimeError as ex: print("The mat is singular") - pass except ValueError as ex: print("The mat is singular") - pass def test_static(self): for place in self.places: @@ -197,10 +195,8 @@ class TestInverseSingularAPI(unittest.TestCase): result = paddle.inverse(input) except RuntimeError as ex: print("The mat is singular") - pass except ValueError as ex: print("The mat is singular") - pass if __name__ == "__main__": diff --git a/python/paddle/fluid/tests/unittests/test_io_save_load.py b/python/paddle/fluid/tests/unittests/test_io_save_load.py index 30e80180c8853b69d5a0690329c1e727adb79f0b..f5feb8b78d604591dbadd70c9f6199acd42dd927 100644 --- a/python/paddle/fluid/tests/unittests/test_io_save_load.py +++ b/python/paddle/fluid/tests/unittests/test_io_save_load.py @@ -16,7 +16,7 @@ import unittest import paddle import paddle.fluid as fluid from paddle.fluid import core -from paddle.fluid.framework import _test_eager_guard, _in_legacy_dygraph +from paddle.fluid.framework import _test_eager_guard import tempfile import os diff --git a/python/paddle/fluid/tests/unittests/test_iou_similarity_op.py b/python/paddle/fluid/tests/unittests/test_iou_similarity_op.py index 98c594d8e54c3a3d2eff911bb8de5acbfb666fe4..4d7c66993c0d9dc95da39dc7936c49750585d5c8 100644 --- a/python/paddle/fluid/tests/unittests/test_iou_similarity_op.py +++ b/python/paddle/fluid/tests/unittests/test_iou_similarity_op.py @@ -13,10 +13,7 @@ # limitations under the License. import unittest -import numpy as np import numpy.random as random -import sys -import math from op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/test_ir_graph.py b/python/paddle/fluid/tests/unittests/test_ir_graph.py index ba6e4a8b2effade67821f5da9c2bbf7849a8cf79..c465e4bca2cd46377990d7d2aa7b2a7501eef971 100644 --- a/python/paddle/fluid/tests/unittests/test_ir_graph.py +++ b/python/paddle/fluid/tests/unittests/test_ir_graph.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os import unittest import six from paddle import fluid diff --git a/python/paddle/fluid/tests/unittests/test_ir_memory_optimize_ifelse_op.py b/python/paddle/fluid/tests/unittests/test_ir_memory_optimize_ifelse_op.py index a986fd1cc1ead0137efbaed5d355d06e2c5a1acd..9cc78982aab5793e2a206ea467fda86bace29dd3 100644 --- a/python/paddle/fluid/tests/unittests/test_ir_memory_optimize_ifelse_op.py +++ b/python/paddle/fluid/tests/unittests/test_ir_memory_optimize_ifelse_op.py @@ -25,9 +25,7 @@ import paddle.fluid.core as core from paddle.fluid import compiler, Program, program_guard from paddle.fluid.executor import Executor -from paddle.fluid.backward import append_backward from paddle.fluid.optimizer import MomentumOptimizer -from ir_memory_optimize_net_base import TestIrMemOptBase class TestIrMemoryOptimizeIfElseOp(unittest.TestCase): diff --git a/python/paddle/fluid/tests/unittests/test_ir_memory_optimize_pass.py b/python/paddle/fluid/tests/unittests/test_ir_memory_optimize_pass.py index ac57e1b92243f05f401490b07c5cf1ad129c3b08..d26a0a678940c6a94db708fbc14ea506375dcc84 100644 --- a/python/paddle/fluid/tests/unittests/test_ir_memory_optimize_pass.py +++ b/python/paddle/fluid/tests/unittests/test_ir_memory_optimize_pass.py @@ -17,9 +17,7 @@ import paddle.fluid as fluid import paddle.fluid.core as core import numpy as np import paddle -import paddle.dataset.mnist as mnist import unittest -import os def _feed_data_helper(): diff --git a/python/paddle/fluid/tests/unittests/test_ir_memory_optimize_transformer.py b/python/paddle/fluid/tests/unittests/test_ir_memory_optimize_transformer.py index 38d419530d70d7a392b43171c03fc4ee96660e7d..8b7fe96805fff798dbdd6a86af3246160bdc9e6c 100644 --- a/python/paddle/fluid/tests/unittests/test_ir_memory_optimize_transformer.py +++ b/python/paddle/fluid/tests/unittests/test_ir_memory_optimize_transformer.py @@ -13,13 +13,8 @@ # limitations under the License. import os -import sys import unittest -from timeit import default_timer as timer -import paddle -import paddle.fluid as fluid import paddle.fluid.core as core -import paddle.dataset.wmt16 as wmt16 os.environ['FLAGS_eager_delete_tensor_gb'] = "0.0" diff --git a/python/paddle/fluid/tests/unittests/test_isfinite_op.py b/python/paddle/fluid/tests/unittests/test_isfinite_op.py index 65b197067d9d5970944aa55fa601c6b099083ce8..f2fa252ff0a6d01ad35a8845b8f9cc2b438a0b7c 100644 --- a/python/paddle/fluid/tests/unittests/test_isfinite_op.py +++ b/python/paddle/fluid/tests/unittests/test_isfinite_op.py @@ -18,7 +18,6 @@ import paddle import paddle.fluid as fluid import paddle.fluid.core as core from op_test import OpTest -from paddle.fluid import compiler, Program, program_guard class TestInf(OpTest): diff --git a/python/paddle/fluid/tests/unittests/test_jit_save_load.py b/python/paddle/fluid/tests/unittests/test_jit_save_load.py index 1686af0fc04511684a11de43136e4b7d5dd52418..efb5a196f81835338aed38217ed1b7bd9c649c02 100644 --- a/python/paddle/fluid/tests/unittests/test_jit_save_load.py +++ b/python/paddle/fluid/tests/unittests/test_jit_save_load.py @@ -24,8 +24,8 @@ from paddle.static import InputSpec import paddle.fluid as fluid from paddle.fluid.layers.utils import flatten from paddle.fluid.dygraph import Linear -from paddle.fluid.dygraph import declarative, ProgramTranslator -from paddle.fluid.dygraph.io import INFER_MODEL_SUFFIX, INFER_PARAMS_SUFFIX, INFER_PARAMS_INFO_SUFFIX +from paddle.fluid.dygraph import declarative +from paddle.fluid.dygraph.io import INFER_PARAMS_INFO_SUFFIX from paddle.fluid import unique_name BATCH_SIZE = 32