From 0773639ad90bc36a38e01830a110d0d294c08255 Mon Sep 17 00:00:00 2001 From: Nyakku Shigure Date: Tue, 11 Oct 2022 16:41:59 +0800 Subject: [PATCH] [CodeStyle][F401] remove unused import in unittests/test_[f-j] (#46697) --- .../fluid/tests/unittests/test_fake_dequantize_op.py | 1 - .../tests/unittests/test_faster_tokenizer_op.py | 4 +--- .../unittests/test_feed_data_check_shape_type.py | 1 - .../tests/unittests/test_fetch_lod_tensor_array.py | 2 -- .../fluid/tests/unittests/test_fetch_unmerged.py | 2 -- .../paddle/fluid/tests/unittests/test_fetch_var.py | 1 - .../fluid/tests/unittests/test_fill_any_like_op.py | 3 --- .../paddle/fluid/tests/unittests/test_fill_any_op.py | 3 --- .../unittests/test_fill_constant_batch_size_like.py | 3 --- .../fluid/tests/unittests/test_fill_constant_op.py | 2 +- .../tests/unittests/test_fill_diagonal_tensor_op.py | 4 ---- .../tests/unittests/test_filter_by_instag_op.py | 6 ------ .../unittests/test_flatten_contiguous_range_op.py | 1 - python/paddle/fluid/tests/unittests/test_fleet.py | 2 -- .../fluid/tests/unittests/test_fleet_ascend_utils.py | 6 ------ .../paddle/fluid/tests/unittests/test_fleet_auto.py | 1 - .../paddle/fluid/tests/unittests/test_fleet_base.py | 1 - .../fluid/tests/unittests/test_fleet_base_3.py | 1 - .../fluid/tests/unittests/test_fleet_base_4.py | 1 - .../fluid/tests/unittests/test_fleet_base_single.py | 1 - .../tests/unittests/test_fleet_elastic_collective.py | 5 ----- .../fluid/tests/unittests/test_fleet_elastic_init.py | 4 ---- .../tests/unittests/test_fleet_elastic_manager.py | 3 --- .../tests/unittests/test_fleet_executor_utils.py | 3 +-- .../fluid/tests/unittests/test_fleet_metric.py | 1 - .../fluid/tests/unittests/test_fleet_nocvm_1.py | 2 -- .../fluid/tests/unittests/test_fleet_rolemaker.py | 1 - .../fluid/tests/unittests/test_fleet_rolemaker_2.py | 2 -- .../fluid/tests/unittests/test_fleet_rolemaker_3.py | 2 -- .../fluid/tests/unittests/test_fleet_rolemaker_4.py | 11 ----------- .../tests/unittests/test_fleet_rolemaker_init.py | 4 ---- .../fluid/tests/unittests/test_fleet_runtime.py | 1 - .../fluid/tests/unittests/test_fleet_unitaccessor.py | 2 -- .../paddle/fluid/tests/unittests/test_fleet_util.py | 4 +--- python/paddle/fluid/tests/unittests/test_flip.py | 1 - python/paddle/fluid/tests/unittests/test_fold_op.py | 1 - .../fluid/tests/unittests/test_fs_interface.py | 6 +----- python/paddle/fluid/tests/unittests/test_fsp_op.py | 2 -- .../fluid/tests/unittests/test_full_like_op.py | 1 - python/paddle/fluid/tests/unittests/test_full_op.py | 5 +---- .../fluid/tests/unittests/test_function_hook.py | 3 +-- .../fluid/tests/unittests/test_functional_conv1d.py | 2 -- .../unittests/test_functional_conv1d_transpose.py | 2 -- .../tests/unittests/test_fuse_bn_add_act_pass.py | 1 - .../tests/unittests/test_fuse_gemm_epilogue_pass.py | 1 - .../tests/unittests/test_fuse_optimizer_pass.py | 2 +- .../unittests/test_fuse_relu_depthwise_conv_pass.py | 2 -- .../fluid/tests/unittests/test_fused_attention_op.py | 2 -- .../tests/unittests/test_fused_attention_op_api.py | 7 +------ ...test_fused_bias_dropout_residual_layer_norm_op.py | 8 +------- ..._fused_bias_dropout_residual_layer_norm_op_api.py | 7 +------ .../tests/unittests/test_fused_emb_seq_pool_op.py | 4 ---- .../tests/unittests/test_fused_feedforward_op.py | 2 -- .../tests/unittests/test_fused_gate_attention_op.py | 4 +--- .../test_fused_multi_transformer_int8_op.py | 12 ++---------- .../unittests/test_fused_multi_transformer_op.py | 10 +--------- .../unittests/test_fused_multihead_matmul_op.py | 1 - .../tests/unittests/test_fused_token_prune_op.py | 1 - .../fluid/tests/unittests/test_fusion_gru_op.py | 1 - .../unittests/test_fusion_seqconv_eltadd_relu_op.py | 1 - .../fluid/tests/unittests/test_gaussian_random_op.py | 3 --- python/paddle/fluid/tests/unittests/test_gcd.py | 2 -- .../tests/unittests/test_generate_mask_labels_op.py | 2 -- .../unittests/test_generate_proposal_labels_op.py | 3 --- .../tests/unittests/test_generate_proposals_op.py | 2 -- .../tests/unittests/test_generate_proposals_v2_op.py | 4 ---- .../paddle/fluid/tests/unittests/test_generator.py | 1 - .../unittests/test_get_all_op_or_kernel_names.py | 1 - .../tests/unittests/test_get_device_properties.py | 1 - .../unittests/test_gpu_package_without_gpu_device.py | 2 -- .../fluid/tests/unittests/test_grad_clip_minimize.py | 4 ---- .../fluid/tests/unittests/test_gradient_clip.py | 1 - .../fluid/tests/unittests/test_graph_reindex.py | 1 - .../fluid/tests/unittests/test_graph_send_recv_op.py | 1 - .../tests/unittests/test_graph_send_ue_recv_op.py | 1 - .../fluid/tests/unittests/test_graph_send_uv_op.py | 2 -- .../tests/unittests/test_grid_sample_function.py | 2 +- .../fluid/tests/unittests/test_group_norm_op.py | 1 - .../fluid/tests/unittests/test_group_norm_op_v2.py | 4 ---- python/paddle/fluid/tests/unittests/test_gru_op.py | 3 +-- .../paddle/fluid/tests/unittests/test_gru_rnn_op.py | 3 --- .../fluid/tests/unittests/test_gumbel_softmax_op.py | 2 -- .../fluid/tests/unittests/test_histogram_op.py | 1 - .../paddle/fluid/tests/unittests/test_hsigmoid_op.py | 1 - .../fluid/tests/unittests/test_huber_loss_op.py | 2 +- .../tests/unittests/test_hybrid_parallel_topology.py | 2 -- .../fluid/tests/unittests/test_identity_loss_op.py | 1 - .../paddle/fluid/tests/unittests/test_identity_op.py | 2 -- .../fluid/tests/unittests/test_imperative_base.py | 3 --- .../fluid/tests/unittests/test_imperative_basic.py | 3 +-- .../unittests/test_imperative_container_layerdict.py | 1 - .../test_imperative_container_parameterlist.py | 2 +- .../unittests/test_imperative_data_loader_base.py | 2 -- .../test_imperative_data_loader_exception.py | 1 - .../test_imperative_data_loader_exit_func.py | 1 - .../test_imperative_data_loader_fds_clear.py | 2 -- .../unittests/test_imperative_data_loader_process.py | 1 - .../tests/unittests/test_imperative_data_parallel.py | 3 --- .../tests/unittests/test_imperative_double_grad.py | 3 +-- .../fluid/tests/unittests/test_imperative_gan.py | 4 +--- .../fluid/tests/unittests/test_imperative_gnn.py | 1 - .../fluid/tests/unittests/test_imperative_group.py | 7 ------- .../unittests/test_imperative_hook_for_layer.py | 3 --- .../fluid/tests/unittests/test_imperative_layers.py | 3 +-- .../test_imperative_lod_tensor_to_selected_rows.py | 1 - .../fluid/tests/unittests/test_imperative_mnist.py | 4 +--- .../test_imperative_mnist_sorted_gradient.py | 1 - .../tests/unittests/test_imperative_named_members.py | 2 +- .../tests/unittests/test_imperative_optimizer.py | 2 -- .../tests/unittests/test_imperative_optimizer_v2.py | 2 -- .../test_imperative_parallel_coalesce_split.py | 2 -- .../test_imperative_ptb_rnn_sorted_gradient.py | 1 - .../unittests/test_imperative_recurrent_usage.py | 4 ---- .../tests/unittests/test_imperative_reinforcement.py | 3 --- .../fluid/tests/unittests/test_imperative_resnet.py | 1 - .../tests/unittests/test_imperative_save_load.py | 5 +---- .../tests/unittests/test_imperative_save_load_v2.py | 5 +---- .../tests/unittests/test_imperative_se_resnext.py | 2 -- .../tests/unittests/test_imperative_selected_rows.py | 1 - ...test_imperative_star_gan_with_gradient_penalty.py | 4 ++-- .../unittests/test_imperative_static_runner_mnist.py | 3 --- .../unittests/test_imperative_static_runner_while.py | 3 --- .../test_imperative_transformer_sorted_gradient.py | 2 +- .../tests/unittests/test_imperative_triple_grad.py | 3 +-- .../fluid/tests/unittests/test_index_add_op.py | 4 +--- .../fluid/tests/unittests/test_index_select_op.py | 1 - .../unittests/test_infer_no_need_buffer_slots.py | 1 - .../fluid/tests/unittests/test_inference_api.py | 3 +-- .../fluid/tests/unittests/test_inference_model_io.py | 1 - python/paddle/fluid/tests/unittests/test_inner.py | 2 +- python/paddle/fluid/tests/unittests/test_inplace.py | 3 +-- .../fluid/tests/unittests/test_inplace_abn_op.py | 3 --- .../tests/unittests/test_inplace_addto_strategy.py | 2 -- .../unittests/test_inplace_and_clear_gradient.py | 3 +-- .../unittests/test_inplace_auto_generated_apis.py | 2 -- .../test_inplace_softmax_with_cross_entropy.py | 2 -- .../paddle/fluid/tests/unittests/test_input_spec.py | 2 +- .../fluid/tests/unittests/test_instance_norm_op.py | 2 -- .../tests/unittests/test_instance_norm_op_v2.py | 4 ---- .../paddle/fluid/tests/unittests/test_inverse_op.py | 4 ---- .../fluid/tests/unittests/test_io_save_load.py | 2 +- .../fluid/tests/unittests/test_iou_similarity_op.py | 3 --- python/paddle/fluid/tests/unittests/test_ir_graph.py | 1 - .../unittests/test_ir_memory_optimize_ifelse_op.py | 2 -- .../tests/unittests/test_ir_memory_optimize_pass.py | 2 -- .../unittests/test_ir_memory_optimize_transformer.py | 5 ----- .../paddle/fluid/tests/unittests/test_isfinite_op.py | 1 - .../fluid/tests/unittests/test_jit_save_load.py | 4 ++-- 148 files changed, 40 insertions(+), 345 deletions(-) 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 a1c1532459e..239f5a93b1f 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 e797b250fae..44aa0225059 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 97a0c8ebc96..be58e03f661 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 649384cc767..2b59c88948d 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 ab8ea8d3e4b..e9ce5294c37 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 71c32623d08..1ce597ef98a 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 711aeb15e19..fae7b3c2b0a 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 794bd170b69..7dbdfe8d58a 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 e6296eb94d0..ebe0ed179d2 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 904ce15215f..4737d209395 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 a35dd611cb2..9823f5e2585 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 c7818712f0a..b60dcbe9c89 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 991c13a6ecf..b938adfbf14 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 b0dec291cad..a06f2647509 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 1dda13e88b3..7ee6ee83f22 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 7f37e7b2a44..29710dc5885 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 46263d1a10e..aba343b1f29 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 c81d96bafd3..40ee3836dd2 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 fa154285f21..5d70193212c 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 a782bf3842d..776a286d97d 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 7e37c8ff086..8d31fc4efb5 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 cd3272fd9d8..e32f74ffb14 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 1994e5021e9..3c07edc7803 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 a8fe4f05b99..cbc54e8c70f 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 9141033165d..f4af98e649d 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 67c75550c04..81daea3af93 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 b422503d34a..9824b59028f 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 6049ba3fee8..b60c43a209a 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 a8ad393ca6c..2e639a81679 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 2f7aeb62215..14d5277446b 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 7743331eae1..dfc88afaf1f 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 19c407bf57f..21a0afab012 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 a930b74042d..09cc08dc327 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 de55ac2f080..1b6f2cf8552 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 3cd060cced0..ddf3534ad33 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 e3b1b267cb2..62833173909 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 e97093c8cd5..22e07f9030f 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 0f7eb4ad95d..bac40a98d4b 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 cb4d69389d8..fe565140e70 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 b214a0b6573..c55e17923be 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 1ea1e503ab9..b884d62e7d3 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 88dd98f1f3a..251ac52451d 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 3d719de3674..98daff216a7 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 a89d18b6b12..67c4879a05a 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 de75cca6f45..1d7dc0e70d4 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 981d9dfcf4a..5021870e9b6 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 a9e9a588e85..a93c1380c0b 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 1ad29ecadd7..1e27005499a 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 bf8983eee84..ee8efdc81d0 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 f31cc78986e..7572a1dfe14 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 f0c6bd83d40..aa54860e099 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 cec35cbe0f8..5963ef07e92 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 f979e896fbd..85b7ee9285d 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 f911d614ee4..2baab279462 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 00f25b4570c..3384e86668e 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 b91081aa89a..dcfb7294040 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 3292d1ae47c..717a98abd50 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 9425283f078..adfb9e09177 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 d3b0faa72de..e2aa2fc901e 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 d64bb77bbbd..cceced75adc 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 331aa0f20fa..16e34dc6789 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 b64e307fb52..d5ef16cea42 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 93dcfdadf6a..3a2a6e9eb50 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 0c5a6756717..4b5a5ebc2ba 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 496d2ca1275..d5fbca5be9e 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 f25ff6b7d72..06db10c5bd5 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 99d740f1958..515581029ab 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 0a07305507f..999912494ad 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 750a257b0d9..e29b565ff45 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 ecfe0f05a66..fc130426aef 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 192df0a904e..fc8c1c946bb 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 6cc2da456aa..825e84f9f6d 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 668d1525c81..db1d7d3cff9 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 8fb97ef3487..40d1673438f 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 b2a0adf115f..bf74885ba5a 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 7e3ebaeffbe..3ee79f1268b 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 90e80e013ec..7255f82bc07 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 74bc2a803df..3ae2bf0a391 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 26073401b68..52889f757df 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 a92837be296..4e51c1da0e8 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 abce0e11278..0a10eb74f55 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 a411289dcbf..90de83fce24 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 321fbfbabfd..725b6c02362 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 22b6e286268..66cb6ac427a 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 035fee7b4ea..d679d2b719f 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 926d31098a4..00b1f10ede8 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 6f500aaa623..de81c16da7d 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 c4ab5791828..f257db187eb 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 1dd5348a885..d882bb772c6 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 452d8e72672..3c8088a1055 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 34050b5bf74..2e7bd103ec5 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 3deada01f4a..2101e84858a 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 4ef5f423d4d..5ae1b3f0014 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 034d38c4e8a..4cc6d813bf8 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 f50c1e912fb..8c201d85a9c 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 bb7bb89d781..f0bdc8dacba 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 0f1be02f373..9d4b6953541 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 7b703c8d2f1..4d61d2a67fd 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 d71d2aba63d..ae1fe6d3706 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 3a52bcc1ead..b2a815c6d5f 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 721ce897210..f001e7c4e0c 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 4080d38ea4b..f67592312c8 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 3dd48601b11..1f60bf20e09 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 4f7e8c1ac16..e2b9855af41 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 7e4a706c8a8..ddd403b0f60 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 5813ff595c2..b4178028521 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 89e5ab03408..80d63921d36 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 c3b052edeac..57fad812bf8 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 370a009474a..3c078ffbde5 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 ba953d2762a..f8446d22ff7 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 54da2becfde..7c6d13399c0 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 93890a2aaa8..2422383bbde 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 72794390bf4..622d174eefc 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 e0802b0202a..2e72413673d 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 2f266c38458..27a56884462 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 d93c8fe9b4e..7933d4f1545 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 37f5760d2da..0e051381adf 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 aa73e0412f7..dfae761553d 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 5a5017a73b4..602d2e07ce5 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 5b08c616792..4b394ba87fd 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 aaa3f32ecf5..ff076d836f8 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 f865a06b493..f6ebc0b394a 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 51eb793c8e7..090384bec80 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 fab9313048f..7f0ea807271 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 95385d33b88..f3b799f0d35 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 dd45d130d00..2d73a29e2c9 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 8935a8aa370..51f6cd53ca3 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 a590dcecbfe..27ddf815aa0 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 4185c621b5e..c901dd472ec 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 d0e28404944..cf631101e8e 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 37a45b542eb..0d88a35ff24 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 cf32476fbf4..998480a9193 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 d954304b8df..825fcbd0620 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 58a35a71199..7f4bf6a5fef 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 eef8318bf37..09e8c611236 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 643ff14b878..759454a2887 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 79f8bd1ebde..bb31c4e7f51 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 23f1ff981f3..88bed96b352 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 28560cccec1..cbb91795a50 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 ec0a94c3c04..b155df0498d 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 30e80180c88..f5feb8b78d6 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 98c594d8e54..4d7c66993c0 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 ba6e4a8b2ef..c465e4bca2c 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 a986fd1cc1e..9cc78982aab 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 ac57e1b9224..d26a0a67894 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 38d419530d7..8b7fe96805f 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 65b197067d9..f2fa252ff0a 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 1686af0fc04..efb5a196f81 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 -- GitLab