From 499d2daf81f6d5c222749505ee99d99e9fc0322b Mon Sep 17 00:00:00 2001 From: Nyakku Shigure Date: Wed, 19 Oct 2022 15:36:30 +0800 Subject: [PATCH] [CodeStyle][F403] expand star import (#46946) --- python/paddle/__init__.py | 4 +-- python/paddle/distributed/__init__.py | 5 ++-- .../fleet/base/meta_optimizer_factory.py | 2 +- .../distributed/fleet/elastic/collective.py | 6 +++-- python/paddle/distributed/fleet/launch.py | 8 +++--- .../fleet/meta_optimizers/ps_optimizer.py | 2 +- python/paddle/distributed/passes/__init__.py | 25 +++++++++---------- .../distributed/passes/ps_server_pass.py | 5 +++- .../distributed/passes/ps_trainer_pass.py | 2 +- python/paddle/distributed/ps/the_one_ps.py | 2 +- .../paddle/distributed/ps/utils/ps_factory.py | 4 +-- .../ps/utils/ps_program_builder.py | 2 +- .../fluid/tests/test_beam_search_decoder.py | 2 +- .../collective/fleet/test_recv_save_op.py | 2 +- .../distribution/test_distribution.py | 2 +- .../test_distribution_categorical.py | 2 +- .../distribution/test_distribution_normal.py | 2 +- .../distribution/test_distribution_uniform.py | 2 +- .../dygraph_to_static/test_ifelse.py | 2 +- .../dygraph_to_static/test_origin_info.py | 2 +- .../unittests/dygraph_to_static/test_tsm.py | 2 +- .../tests/unittests/ps/ps_dnn_trainer.py | 2 +- .../fluid/tests/unittests/ps/test_fl_ps.py | 1 - .../tests/unittests/ps/test_the_one_ps.py | 2 +- .../unittests/test_dataloader_dataset.py | 2 +- .../unittests/test_default_scope_funcs.py | 2 +- .../fluid/tests/unittests/test_dist_train.py | 2 +- .../tests/unittests/test_distributions.py | 2 +- .../unittests/test_dynrnn_gradient_check.py | 2 +- .../test_imperative_load_static_param.py | 2 +- .../fluid/tests/unittests/test_lazy_init.py | 2 +- .../unittests/test_listen_and_serv_op.py | 3 ++- python/paddle/profiler/profiler_statistic.py | 2 +- 33 files changed, 58 insertions(+), 51 deletions(-) diff --git a/python/paddle/__init__.py b/python/paddle/__init__.py index 2cfcde0532a..7312a0d9f80 100755 --- a/python/paddle/__init__.py +++ b/python/paddle/__init__.py @@ -14,7 +14,7 @@ try: from paddle.version import full_version as __version__ from paddle.version import commit as __git_commit__ - from paddle.cuda_env import * + from paddle.cuda_env import * # noqa: F403 except ImportError: import sys sys.stderr.write('''Warning with import paddle: you should not @@ -35,7 +35,7 @@ from .framework import set_flags # noqa: F401 from .framework import disable_static # noqa: F401 from .framework import enable_static # noqa: F401 from .framework import in_dynamic_mode # noqa: F401 -from .fluid.dataset import * # noqa: F401 +from .fluid.dataset import * # noqa: F401, F403 from .fluid.lazy_init import LazyGuard # noqa: F401 from .framework.dtype import iinfo # noqa: F401 diff --git a/python/paddle/distributed/__init__.py b/python/paddle/distributed/__init__.py index 6cad4678463..13c305b58da 100644 --- a/python/paddle/distributed/__init__.py +++ b/python/paddle/distributed/__init__.py @@ -51,7 +51,7 @@ from .collective import batch_isend_irecv # noqa: F401 from .collective import P2POp # noqa: F401 from .collective import reduce_scatter # noqa: F401 -from .communication import * # noqa: F401 +from .communication import stream # noqa: F401 from .auto_parallel import shard_op # noqa: F401 from .auto_parallel import shard_tensor # noqa: F401 @@ -66,7 +66,8 @@ from paddle.fluid.dygraph.parallel import ParallelEnv # noqa: F401 from . import cloud_utils # noqa: F401 -from .sharding import * # noqa: F401 +from .sharding import group_sharded_parallel # noqa: F401 +from .sharding import save_group_sharded_model # noqa: F401 from . import rpc diff --git a/python/paddle/distributed/fleet/base/meta_optimizer_factory.py b/python/paddle/distributed/fleet/base/meta_optimizer_factory.py index 825ccd7889b..c2e55cfc38d 100755 --- a/python/paddle/distributed/fleet/base/meta_optimizer_factory.py +++ b/python/paddle/distributed/fleet/base/meta_optimizer_factory.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ..meta_optimizers import * # noqa: F401 +from ..meta_optimizers import * # noqa: F401, F403 __all__ = [] diff --git a/python/paddle/distributed/fleet/elastic/collective.py b/python/paddle/distributed/fleet/elastic/collective.py index b2920d412b6..aa5c962b994 100644 --- a/python/paddle/distributed/fleet/elastic/collective.py +++ b/python/paddle/distributed/fleet/elastic/collective.py @@ -13,9 +13,11 @@ # limitations under the License. import tempfile +import os +import shutil +import paddle -from paddle.distributed.fleet.launch_utils import * - +from paddle.distributed.fleet.launch_utils import logger, pull_worker_log, start_local_trainers from paddle.distributed.fleet.elastic.manager import LauncherInterface diff --git a/python/paddle/distributed/fleet/launch.py b/python/paddle/distributed/fleet/launch.py index 98919fe2414..5fcc0e6a33b 100755 --- a/python/paddle/distributed/fleet/launch.py +++ b/python/paddle/distributed/fleet/launch.py @@ -65,9 +65,11 @@ import pathlib from argparse import ArgumentParser, REMAINDER import paddle.fluid as fluid from paddle.distributed.fleet import launch_utils - -# TODO(danleifeng): Don't import * from a module -from paddle.distributed.fleet.launch_utils import * +from paddle.distributed.fleet.launch_utils import ( + get_host_name_ip, find_free_ports, logger, get_cluster, DeviceMode, + start_local_trainers, direct_start, watch_local_trainers, + terminate_local_procs, DistributeMode, ParameterServerLauncher, get_logger, + check_backend, block_windows_and_macos) from paddle.distributed.fleet import cloud_utils from paddle.distributed.fleet import ascend_utils diff --git a/python/paddle/distributed/fleet/meta_optimizers/ps_optimizer.py b/python/paddle/distributed/fleet/meta_optimizers/ps_optimizer.py index c1c40f7213a..523a6741102 100755 --- a/python/paddle/distributed/fleet/meta_optimizers/ps_optimizer.py +++ b/python/paddle/distributed/fleet/meta_optimizers/ps_optimizer.py @@ -19,7 +19,7 @@ import subprocess import re import os import platform -from paddle.distributed.ps.utils.public import * +from paddle.distributed.ps.utils.public import TrainerRuntimeConfig, build_var_distributed, dtype_to_size, get_dist_env, get_var_mem_size, logger from paddle.distributed.passes import PassContext from paddle.distributed.ps.utils.ps_factory import PsProgramBuilderFactory diff --git a/python/paddle/distributed/passes/__init__.py b/python/paddle/distributed/passes/__init__.py index 5f721a1df50..056540a4a15 100644 --- a/python/paddle/distributed/passes/__init__.py +++ b/python/paddle/distributed/passes/__init__.py @@ -13,19 +13,18 @@ # limitations under the License. from .pass_base import new_pass, PassManager, PassContext -from .fuse_all_reduce import * -from .auto_parallel_gradient_merge import * -from .auto_parallel_sharding import * -from .auto_parallel_amp import * -from .auto_parallel_fp16 import * -from .auto_parallel_recompute import * -from .auto_parallel_quantization import * -from .auto_parallel_data_parallel_optimization import * -from .auto_parallel_grad_clip import * -from .cpp_pass import * -import os -from .ps_trainer_pass import * -from .ps_server_pass import * +from .fuse_all_reduce import * # noqa: F403 +from .auto_parallel_gradient_merge import * # noqa: F403 +from .auto_parallel_sharding import * # noqa: F403 +from .auto_parallel_amp import * # noqa: F403 +from .auto_parallel_fp16 import * # noqa: F403 +from .auto_parallel_recompute import * # noqa: F403 +from .auto_parallel_quantization import * # noqa: F403 +from .auto_parallel_data_parallel_optimization import * # noqa: F403 +from .auto_parallel_grad_clip import * # noqa: F403 +from .cpp_pass import * # noqa: F403 +from .ps_trainer_pass import * # noqa: F403 +from .ps_server_pass import * # noqa: F403 __all__ = [ 'new_pass', diff --git a/python/paddle/distributed/passes/ps_server_pass.py b/python/paddle/distributed/passes/ps_server_pass.py index 64c7f7fb912..27c10fd1f5b 100755 --- a/python/paddle/distributed/passes/ps_server_pass.py +++ b/python/paddle/distributed/passes/ps_server_pass.py @@ -12,7 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ..ps.utils.public import * +import logging + +import paddle.fluid as fluid +from ..ps.utils.public import get_optimize_ops, get_ps_endpoint, get_role_id, get_trainers from .pass_base import PassBase, register_pass from paddle.optimizer.lr import LRScheduler from paddle.optimizer.lr import ExponentialDecay, InverseTimeDecay, NaturalExpDecay, NoamDecay diff --git a/python/paddle/distributed/passes/ps_trainer_pass.py b/python/paddle/distributed/passes/ps_trainer_pass.py index 95f4e980cf4..1b5eb1e442f 100755 --- a/python/paddle/distributed/passes/ps_trainer_pass.py +++ b/python/paddle/distributed/passes/ps_trainer_pass.py @@ -14,7 +14,7 @@ import os import paddle -from ..ps.utils.public import * +from ..ps.utils.public import * # noqa: F403 from paddle.framework import core from paddle.distributed.passes.pass_base import PassBase, register_pass from paddle.fluid.transpiler.details.program_utils import delete_ops diff --git a/python/paddle/distributed/ps/the_one_ps.py b/python/paddle/distributed/ps/the_one_ps.py index 965468d7373..78ecef22b63 100755 --- a/python/paddle/distributed/ps/the_one_ps.py +++ b/python/paddle/distributed/ps/the_one_ps.py @@ -18,7 +18,7 @@ import os import paddle.fluid as fluid from paddle.distributed import fleet from paddle.fluid import core -from paddle.distributed.ps.utils.public import * +from paddle.distributed.ps.utils.public import * # noqa: F403 from paddle.fluid.framework import Program from paddle.fluid.compiler import CompiledProgram from paddle.fluid.executor import Executor diff --git a/python/paddle/distributed/ps/utils/ps_factory.py b/python/paddle/distributed/ps/utils/ps_factory.py index 2fc1a06ad96..1f522ec27f8 100755 --- a/python/paddle/distributed/ps/utils/ps_factory.py +++ b/python/paddle/distributed/ps/utils/ps_factory.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .ps_program_builder import * -from .public import * +from .ps_program_builder import * # noqa: F403 +from .public import * # noqa: F403 __all__ = [ 'PsProgramBuilder', 'GeoPsProgramBuilder', 'CpuSyncPsProgramBuilder', diff --git a/python/paddle/distributed/ps/utils/ps_program_builder.py b/python/paddle/distributed/ps/utils/ps_program_builder.py index 2a8d273d992..f38ca4f016d 100755 --- a/python/paddle/distributed/ps/utils/ps_program_builder.py +++ b/python/paddle/distributed/ps/utils/ps_program_builder.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .public import * +from .public import * # noqa: F403 from paddle.distributed.fleet.base.private_helper_function import wait_server_ready from paddle.distributed.passes import new_pass diff --git a/python/paddle/fluid/tests/test_beam_search_decoder.py b/python/paddle/fluid/tests/test_beam_search_decoder.py index 7458bf4c57c..66cd8e89d32 100644 --- a/python/paddle/fluid/tests/test_beam_search_decoder.py +++ b/python/paddle/fluid/tests/test_beam_search_decoder.py @@ -22,7 +22,7 @@ import paddle.fluid as fluid import paddle.fluid.framework as framework import paddle.fluid.layers as layers from paddle.fluid.executor import Executor -from paddle.fluid.contrib.decoder.beam_search_decoder import * +from paddle.fluid.contrib.decoder.beam_search_decoder import BeamSearchDecoder, InitState, StateCell, TrainingDecoder import unittest paddle.enable_static() diff --git a/python/paddle/fluid/tests/unittests/collective/fleet/test_recv_save_op.py b/python/paddle/fluid/tests/unittests/collective/fleet/test_recv_save_op.py index 2da9079467f..927b02d74eb 100644 --- a/python/paddle/fluid/tests/unittests/collective/fleet/test_recv_save_op.py +++ b/python/paddle/fluid/tests/unittests/collective/fleet/test_recv_save_op.py @@ -25,7 +25,7 @@ import paddle.fluid as fluid import paddle.fluid.core as core from paddle.fluid.op import Operator from paddle.fluid.framework import Program, program_guard -from dist_test_utils import * +from dist_test_utils import remove_ps_flag from paddle.fluid.incubate.fleet.parameter_server.mode import DistributedMode diff --git a/python/paddle/fluid/tests/unittests/distribution/test_distribution.py b/python/paddle/fluid/tests/unittests/distribution/test_distribution.py index 4d951a60960..30024c10fee 100644 --- a/python/paddle/fluid/tests/unittests/distribution/test_distribution.py +++ b/python/paddle/fluid/tests/unittests/distribution/test_distribution.py @@ -16,7 +16,7 @@ import unittest import numpy as np import paddle -from paddle.distribution import * +from paddle.distribution import Categorical, Normal, Uniform from paddle.fluid import layers import config diff --git a/python/paddle/fluid/tests/unittests/distribution/test_distribution_categorical.py b/python/paddle/fluid/tests/unittests/distribution/test_distribution_categorical.py index 7be3bcb5575..4be500b6084 100644 --- a/python/paddle/fluid/tests/unittests/distribution/test_distribution_categorical.py +++ b/python/paddle/fluid/tests/unittests/distribution/test_distribution_categorical.py @@ -17,7 +17,7 @@ import unittest import numpy as np import paddle from paddle import fluid -from paddle.distribution import * +from paddle.distribution import Categorical, Distribution, Normal, Uniform from paddle.fluid import layers from test_distribution import DistributionNumpy diff --git a/python/paddle/fluid/tests/unittests/distribution/test_distribution_normal.py b/python/paddle/fluid/tests/unittests/distribution/test_distribution_normal.py index 1873ac7efa6..d9040559955 100644 --- a/python/paddle/fluid/tests/unittests/distribution/test_distribution_normal.py +++ b/python/paddle/fluid/tests/unittests/distribution/test_distribution_normal.py @@ -19,7 +19,7 @@ import config import numpy as np import paddle from paddle import fluid -from paddle.distribution import * +from paddle.distribution import Normal from paddle.fluid import layers from parameterize import TEST_CASE_NAME, parameterize_cls, place, xrand import scipy.stats diff --git a/python/paddle/fluid/tests/unittests/distribution/test_distribution_uniform.py b/python/paddle/fluid/tests/unittests/distribution/test_distribution_uniform.py index 7b6a3a2a3bd..6aafa9cb356 100644 --- a/python/paddle/fluid/tests/unittests/distribution/test_distribution_uniform.py +++ b/python/paddle/fluid/tests/unittests/distribution/test_distribution_uniform.py @@ -17,7 +17,7 @@ import unittest import numpy as np import paddle from paddle import fluid -from paddle.distribution import * +from paddle.distribution import Uniform from paddle.fluid import layers from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_ifelse.py b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_ifelse.py index 6870e8c08da..d40c37f3fd6 100644 --- a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_ifelse.py +++ b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_ifelse.py @@ -21,7 +21,7 @@ from paddle.fluid.dygraph.dygraph_to_static.program_translator import ProgramTra from paddle.fluid.dygraph.dygraph_to_static.utils import Dygraph2StaticException import paddle.fluid.core as core -from ifelse_simple_func import * +from ifelse_simple_func import NetWithControlFlowIf, add_fn, dyfunc_empty_nonlocal, dyfunc_ifelse_ret_int1, dyfunc_ifelse_ret_int2, dyfunc_ifelse_ret_int3, dyfunc_ifelse_ret_int4, dyfunc_with_if_else, dyfunc_with_if_else2, dyfunc_with_if_else3, dyfunc_with_if_else_with_list_geneator, fluid, if_tensor_case, if_with_and_or, if_with_and_or_1, if_with_and_or_2, if_with_and_or_3, if_with_and_or_4, if_with_class_var, loss_fn, nested_if_else, nested_if_else_2, nested_if_else_3 np.random.seed(1) diff --git a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_origin_info.py b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_origin_info.py index 07260c9c0b8..744cc40cdfb 100644 --- a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_origin_info.py +++ b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_origin_info.py @@ -16,7 +16,7 @@ import sys import unittest from paddle.fluid.dygraph.dygraph_to_static.ast_transformer import DygraphToStaticAst -from paddle.fluid.dygraph.dygraph_to_static.origin_info import * +from paddle.fluid.dygraph.dygraph_to_static.origin_info import Location, ORIGI_INFO, OriginInfo, attach_origin_info, create_and_update_origin_info_map, gast, inspect, unwrap from paddle.fluid.dygraph.dygraph_to_static.utils import ast_to_func from paddle.fluid.dygraph.jit import declarative diff --git a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_tsm.py b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_tsm.py index 6da285c01b3..7561e7aa137 100644 --- a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_tsm.py +++ b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_tsm.py @@ -22,7 +22,7 @@ import paddle import paddle.fluid as fluid from paddle.fluid.dygraph import declarative, ProgramTranslator, to_variable from paddle.fluid.dygraph.nn import Conv2D, BatchNorm, Linear, Pool2D -from tsm_config_utils import * +from tsm_config_utils import merge_configs, parse_config, print_configs random.seed(0) np.random.seed(0) diff --git a/python/paddle/fluid/tests/unittests/ps/ps_dnn_trainer.py b/python/paddle/fluid/tests/unittests/ps/ps_dnn_trainer.py index d54f86b3863..d40d4f07719 100755 --- a/python/paddle/fluid/tests/unittests/ps/ps_dnn_trainer.py +++ b/python/paddle/fluid/tests/unittests/ps/ps_dnn_trainer.py @@ -13,7 +13,7 @@ # limitations under the License. import paddle.distributed.fleet.base.role_maker as role_maker -from paddle.distributed.ps.utils.ps_program_builder import * +from paddle.distributed.ps.utils.ps_program_builder import debug_program, logger, new_pass, ps_log_root_dir import paddle.distributed.fleet as fleet import argparse import sys diff --git a/python/paddle/fluid/tests/unittests/ps/test_fl_ps.py b/python/paddle/fluid/tests/unittests/ps/test_fl_ps.py index 0a993217eba..2726d7c10cd 100755 --- a/python/paddle/fluid/tests/unittests/ps/test_fl_ps.py +++ b/python/paddle/fluid/tests/unittests/ps/test_fl_ps.py @@ -35,7 +35,6 @@ class FlPsTest(unittest.TestCase): prepare_python_path_and_return_module(__file__) exitcode = os.system(' '.join(cmd)) ''' - pass if __name__ == '__main__': diff --git a/python/paddle/fluid/tests/unittests/ps/test_the_one_ps.py b/python/paddle/fluid/tests/unittests/ps/test_the_one_ps.py index c0d10d63687..b561d82fc5f 100755 --- a/python/paddle/fluid/tests/unittests/ps/test_the_one_ps.py +++ b/python/paddle/fluid/tests/unittests/ps/test_the_one_ps.py @@ -14,7 +14,7 @@ import unittest -from paddle.fluid.tests.unittests.distributed_passes.ps_pass_test_base import * +from paddle.fluid.tests.unittests.distributed_passes.ps_pass_test_base import PsPassTestBase, remove_path_if_exists from paddle.distributed.ps.utils.public import logger, ps_log_root_dir import paddle.distributed.fleet.proto.the_one_ps_pb2 as ps_pb2 # noqa: F401 from google.protobuf import text_format # noqa: F401 diff --git a/python/paddle/fluid/tests/unittests/test_dataloader_dataset.py b/python/paddle/fluid/tests/unittests/test_dataloader_dataset.py index 9734bfef3f0..6b3ab060c3d 100644 --- a/python/paddle/fluid/tests/unittests/test_dataloader_dataset.py +++ b/python/paddle/fluid/tests/unittests/test_dataloader_dataset.py @@ -17,7 +17,7 @@ import unittest import paddle import paddle.vision.transforms as transforms -from paddle.io import * +from paddle.io import Dataset from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_default_scope_funcs.py b/python/paddle/fluid/tests/unittests/test_default_scope_funcs.py index 03e49216559..beae3124ced 100644 --- a/python/paddle/fluid/tests/unittests/test_default_scope_funcs.py +++ b/python/paddle/fluid/tests/unittests/test_default_scope_funcs.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from paddle.fluid.default_scope_funcs import * +from paddle.fluid.default_scope_funcs import enter_local_scope, find_var, get_cur_scope, leave_local_scope, scoped_function, var import unittest diff --git a/python/paddle/fluid/tests/unittests/test_dist_train.py b/python/paddle/fluid/tests/unittests/test_dist_train.py index e32908aea8f..72998542419 100644 --- a/python/paddle/fluid/tests/unittests/test_dist_train.py +++ b/python/paddle/fluid/tests/unittests/test_dist_train.py @@ -26,7 +26,7 @@ from paddle.fluid.layers.io import ListenAndServ from paddle.fluid.layers.io import Recv from paddle.fluid.layers.io import Send import paddle.fluid.layers.ops as ops -from dist_test_utils import * +from dist_test_utils import remove_ps_flag from paddle.fluid import core diff --git a/python/paddle/fluid/tests/unittests/test_distributions.py b/python/paddle/fluid/tests/unittests/test_distributions.py index daf2adacb41..d79e8784e2b 100644 --- a/python/paddle/fluid/tests/unittests/test_distributions.py +++ b/python/paddle/fluid/tests/unittests/test_distributions.py @@ -16,7 +16,7 @@ import numpy as np import unittest from paddle import fluid from paddle.fluid import layers -from paddle.fluid.layers.distributions import * +from paddle.fluid.layers.distributions import Categorical, MultivariateNormalDiag, Normal, Uniform import math diff --git a/python/paddle/fluid/tests/unittests/test_dynrnn_gradient_check.py b/python/paddle/fluid/tests/unittests/test_dynrnn_gradient_check.py index a629158cb93..7b7921d91c2 100644 --- a/python/paddle/fluid/tests/unittests/test_dynrnn_gradient_check.py +++ b/python/paddle/fluid/tests/unittests/test_dynrnn_gradient_check.py @@ -18,7 +18,7 @@ import collections import paddle import paddle.fluid as fluid import unittest -from decorator_helper import * +from decorator_helper import prog_scope class Memory(object): diff --git a/python/paddle/fluid/tests/unittests/test_imperative_load_static_param.py b/python/paddle/fluid/tests/unittests/test_imperative_load_static_param.py index a1c97089234..e61671e39f1 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_load_static_param.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_load_static_param.py @@ -15,7 +15,7 @@ import unittest import paddle.fluid as fluid import paddle.fluid.framework as framework -from paddle.fluid.dygraph.nn import * +from paddle.fluid.dygraph.nn import BatchNorm, Conv2D, Conv3D, Embedding, GroupNorm, LayerNorm, Linear, NCE, PRelu import numpy as np import os import tempfile diff --git a/python/paddle/fluid/tests/unittests/test_lazy_init.py b/python/paddle/fluid/tests/unittests/test_lazy_init.py index 07a290234da..79b3429b10e 100644 --- a/python/paddle/fluid/tests/unittests/test_lazy_init.py +++ b/python/paddle/fluid/tests/unittests/test_lazy_init.py @@ -17,7 +17,7 @@ import unittest import numpy as np from paddle import LazyGuard from paddle.nn import Linear, Layer -from paddle.nn.initializer import * +from paddle.nn.initializer import Constant, Normal, TruncatedNormal, Uniform, XavierNormal, XavierUniform from paddle.fluid import unique_name diff --git a/python/paddle/fluid/tests/unittests/test_listen_and_serv_op.py b/python/paddle/fluid/tests/unittests/test_listen_and_serv_op.py index 62e063179fa..897689d5597 100644 --- a/python/paddle/fluid/tests/unittests/test_listen_and_serv_op.py +++ b/python/paddle/fluid/tests/unittests/test_listen_and_serv_op.py @@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from dist_test_utils import * +import os +from dist_test_utils import remove_ps_flag, silentremove silentremove("test_handle_signal_in_serv_op.flag") silentremove("test_list_and_serv_run_empty_optimize_block.flag") diff --git a/python/paddle/profiler/profiler_statistic.py b/python/paddle/profiler/profiler_statistic.py index d4788c58fe1..c0dc7fea443 100755 --- a/python/paddle/profiler/profiler_statistic.py +++ b/python/paddle/profiler/profiler_statistic.py @@ -17,7 +17,7 @@ import re from paddle.fluid.core import TracerEventType, TracerMemEventType -from .statistic_helper import * +from .statistic_helper import intersection_ranges, merge_ranges, merge_self_ranges, sum_ranges _AllTracerEventType = [ TracerEventType.Operator, TracerEventType.Dataloader, -- GitLab