From 9f83d3c6ea498b0dae9c63aaea05ce47d19acf9e Mon Sep 17 00:00:00 2001 From: Nyakku Shigure Date: Mon, 10 Oct 2022 17:31:02 +0800 Subject: [PATCH] [CodeStyle][F401] remove unused imports in fluid/tests/custom_* (#46717) --- .../fluid/tests/custom_kernel/custom_kernel_dot_setup.py | 1 - .../fluid/tests/custom_kernel/test_custom_kernel_dot.py | 1 - python/paddle/fluid/tests/custom_op/custom_relu_setup.py | 2 -- python/paddle/fluid/tests/custom_op/test_check_abi.py | 1 - .../fluid/tests/custom_op/test_custom_relu_op_jit.py | 2 +- .../fluid/tests/custom_op/test_custom_relu_op_setup.py | 2 -- .../tests/custom_op/test_custom_tanh_double_grad.py | 1 - .../paddle/fluid/tests/custom_op/test_multi_out_jit.py | 1 - python/paddle/fluid/tests/custom_op/utils.py | 1 - .../custom_device_multi_process_collective.py | 1 - .../fluid/tests/custom_runtime/process_group_xccl.py | 3 --- .../custom_runtime/test_collective_process_group_xccl.py | 9 ++++----- .../fluid/tests/custom_runtime/test_custom_cpu_plugin.py | 1 - .../custom_runtime/test_custom_cpu_profiler_plugin.py | 2 -- .../tests/custom_runtime/test_custom_cpu_to_static.py | 1 - 15 files changed, 5 insertions(+), 24 deletions(-) diff --git a/python/paddle/fluid/tests/custom_kernel/custom_kernel_dot_setup.py b/python/paddle/fluid/tests/custom_kernel/custom_kernel_dot_setup.py index ba116526d3f..8b953ca8725 100644 --- a/python/paddle/fluid/tests/custom_kernel/custom_kernel_dot_setup.py +++ b/python/paddle/fluid/tests/custom_kernel/custom_kernel_dot_setup.py @@ -15,7 +15,6 @@ import os import site from paddle.fluid import core -from distutils.sysconfig import get_python_lib from distutils.core import setup, Extension from setuptools.command.build_ext import build_ext diff --git a/python/paddle/fluid/tests/custom_kernel/test_custom_kernel_dot.py b/python/paddle/fluid/tests/custom_kernel/test_custom_kernel_dot.py index 55b3fad1f35..8badd5dfbde 100644 --- a/python/paddle/fluid/tests/custom_kernel/test_custom_kernel_dot.py +++ b/python/paddle/fluid/tests/custom_kernel/test_custom_kernel_dot.py @@ -14,7 +14,6 @@ import os import sys -import site import unittest import numpy as np diff --git a/python/paddle/fluid/tests/custom_op/custom_relu_setup.py b/python/paddle/fluid/tests/custom_op/custom_relu_setup.py index c3a76d65351..7dd3dd7aa7e 100644 --- a/python/paddle/fluid/tests/custom_op/custom_relu_setup.py +++ b/python/paddle/fluid/tests/custom_op/custom_relu_setup.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os - from utils import paddle_includes, extra_compile_args, IS_MAC from paddle.utils.cpp_extension import CUDAExtension, setup, CppExtension diff --git a/python/paddle/fluid/tests/custom_op/test_check_abi.py b/python/paddle/fluid/tests/custom_op/test_check_abi.py index 727e02f62cd..39bcf1ae628 100644 --- a/python/paddle/fluid/tests/custom_op/test_check_abi.py +++ b/python/paddle/fluid/tests/custom_op/test_check_abi.py @@ -13,7 +13,6 @@ # limitations under the License. import unittest -import paddle import os import warnings diff --git a/python/paddle/fluid/tests/custom_op/test_custom_relu_op_jit.py b/python/paddle/fluid/tests/custom_op/test_custom_relu_op_jit.py index e650d606001..b1255bc3879 100644 --- a/python/paddle/fluid/tests/custom_op/test_custom_relu_op_jit.py +++ b/python/paddle/fluid/tests/custom_op/test_custom_relu_op_jit.py @@ -18,7 +18,7 @@ import paddle import numpy as np from paddle.utils.cpp_extension import load, get_build_directory from paddle.utils.cpp_extension.extension_utils import run_cmd -from utils import paddle_includes, extra_cc_args, extra_nvcc_args, IS_WINDOWS, IS_MAC +from utils import IS_MAC, extra_cc_args, extra_nvcc_args, paddle_includes from test_custom_relu_op_setup import custom_relu_dynamic, custom_relu_static from paddle.fluid.framework import _test_eager_guard # Because Windows don't use docker, the shared lib already exists in the diff --git a/python/paddle/fluid/tests/custom_op/test_custom_relu_op_setup.py b/python/paddle/fluid/tests/custom_op/test_custom_relu_op_setup.py index 0cc1b19e654..14c8bb0c6f6 100644 --- a/python/paddle/fluid/tests/custom_op/test_custom_relu_op_setup.py +++ b/python/paddle/fluid/tests/custom_op/test_custom_relu_op_setup.py @@ -18,8 +18,6 @@ import site import unittest import paddle import paddle.static as static -import tempfile -import subprocess import numpy as np from paddle.vision.transforms import Compose, Normalize from paddle.utils.cpp_extension.extension_utils import run_cmd diff --git a/python/paddle/fluid/tests/custom_op/test_custom_tanh_double_grad.py b/python/paddle/fluid/tests/custom_op/test_custom_tanh_double_grad.py index b36c99d1dfa..fb65422758f 100644 --- a/python/paddle/fluid/tests/custom_op/test_custom_tanh_double_grad.py +++ b/python/paddle/fluid/tests/custom_op/test_custom_tanh_double_grad.py @@ -18,7 +18,6 @@ import numpy as np import paddle import paddle.fluid as fluid -import paddle.static as static from paddle.utils.cpp_extension import load, get_build_directory from paddle.utils.cpp_extension.extension_utils import run_cmd from utils import paddle_includes, extra_cc_args, extra_nvcc_args diff --git a/python/paddle/fluid/tests/custom_op/test_multi_out_jit.py b/python/paddle/fluid/tests/custom_op/test_multi_out_jit.py index a3d939df124..eb9b9e4677f 100644 --- a/python/paddle/fluid/tests/custom_op/test_multi_out_jit.py +++ b/python/paddle/fluid/tests/custom_op/test_multi_out_jit.py @@ -13,7 +13,6 @@ # limitations under the License. import os -import subprocess import unittest import numpy as np diff --git a/python/paddle/fluid/tests/custom_op/utils.py b/python/paddle/fluid/tests/custom_op/utils.py index 82361f2a304..adce68cd0f9 100644 --- a/python/paddle/fluid/tests/custom_op/utils.py +++ b/python/paddle/fluid/tests/custom_op/utils.py @@ -14,7 +14,6 @@ import os import sys -import six from distutils.sysconfig import get_python_lib from paddle.utils.cpp_extension.extension_utils import IS_WINDOWS diff --git a/python/paddle/fluid/tests/custom_runtime/custom_device_multi_process_collective.py b/python/paddle/fluid/tests/custom_runtime/custom_device_multi_process_collective.py index 903cc9c7899..21e98710426 100644 --- a/python/paddle/fluid/tests/custom_runtime/custom_device_multi_process_collective.py +++ b/python/paddle/fluid/tests/custom_runtime/custom_device_multi_process_collective.py @@ -14,7 +14,6 @@ import os import sys -import time def train(prefix): diff --git a/python/paddle/fluid/tests/custom_runtime/process_group_xccl.py b/python/paddle/fluid/tests/custom_runtime/process_group_xccl.py index 71d76757c53..b830d0eccf5 100644 --- a/python/paddle/fluid/tests/custom_runtime/process_group_xccl.py +++ b/python/paddle/fluid/tests/custom_runtime/process_group_xccl.py @@ -15,12 +15,9 @@ import unittest import random import numpy as np -import os -import shutil import paddle from paddle.fluid import core -from datetime import timedelta import paddle.fluid.core as core from paddle.fluid.framework import _test_eager_guard from paddle.fluid.dygraph.parallel import ParallelEnv diff --git a/python/paddle/fluid/tests/custom_runtime/test_collective_process_group_xccl.py b/python/paddle/fluid/tests/custom_runtime/test_collective_process_group_xccl.py index 88b7bb8fd43..1127352d85d 100644 --- a/python/paddle/fluid/tests/custom_runtime/test_collective_process_group_xccl.py +++ b/python/paddle/fluid/tests/custom_runtime/test_collective_process_group_xccl.py @@ -14,7 +14,6 @@ import unittest import os -import sys import copy import subprocess import time @@ -27,7 +26,7 @@ def start_local_trainers(cluster, training_script_args, eager_mode=True, log_dir=None): - from paddle.distributed.utils.launch_utils import find_free_ports, watch_local_trainers, get_cluster, TrainerProc + from paddle.distributed.utils.launch_utils import find_free_ports, watch_local_trainers, get_cluster, TrainerProc # noqa: F401 current_env = copy.copy(os.environ.copy()) #paddle broadcast ncclUniqueId use socket, and @@ -83,7 +82,7 @@ def start_local_trainers(cluster, def get_cluster_from_args(selected_gpus): - from paddle.distributed.utils.launch_utils import find_free_ports, watch_local_trainers, get_cluster, TrainerProc + from paddle.distributed.utils.launch_utils import find_free_ports, watch_local_trainers, get_cluster, TrainerProc # noqa: F401 cluster_node_ips = '127.0.0.1' node_ip = '127.0.0.1' @@ -107,7 +106,7 @@ def get_cluster_from_args(selected_gpus): class TestMultipleCustomCPU(unittest.TestCase): def run_mnist_2custom_cpu(self, target_file_name, eager_mode=True): - from paddle.distributed.utils.launch_utils import find_free_ports, watch_local_trainers, get_cluster, TrainerProc + from paddle.distributed.utils.launch_utils import find_free_ports, watch_local_trainers, get_cluster, TrainerProc # noqa: F401 selected_devices = [0, 1] cluster = None @@ -160,7 +159,7 @@ class TestProcessGroup(TestMultipleCustomCPU): self.temp_dir.cleanup() def test_process_group_xccl(self): - from paddle.distributed.utils.launch_utils import find_free_ports, watch_local_trainers, get_cluster, TrainerProc + from paddle.distributed.utils.launch_utils import find_free_ports, watch_local_trainers, get_cluster, TrainerProc # noqa: F401 self.run_mnist_2custom_cpu('process_group_xccl.py') diff --git a/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_plugin.py b/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_plugin.py index 1bba2e73c08..79e3e506b90 100644 --- a/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_plugin.py +++ b/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_plugin.py @@ -14,7 +14,6 @@ import os import sys -import site import unittest import numpy as np import tempfile diff --git a/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_profiler_plugin.py b/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_profiler_plugin.py index 83c846f2ba0..2e307fbb826 100644 --- a/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_profiler_plugin.py +++ b/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_profiler_plugin.py @@ -14,9 +14,7 @@ import os import sys -import site import unittest -import numpy as np import tempfile diff --git a/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_to_static.py b/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_to_static.py index 626b4a6c05f..e5e9638a0b5 100644 --- a/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_to_static.py +++ b/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_to_static.py @@ -24,7 +24,6 @@ BATCH_SIZE = 1024 def train_func_base(epoch_id, train_loader, model, cost, optimizer): - import paddle total_step = len(train_loader) epoch_start = time.time() -- GitLab