From 6977df8c59113ac84784ffa05b96fae2dd66f2b4 Mon Sep 17 00:00:00 2001 From: Shuangchi He <34329208+Yulv-git@users.noreply.github.com> Date: Wed, 12 Oct 2022 10:32:54 +0800 Subject: [PATCH] [CodeStyle][F401] remove unused imports in python_paddle/inference_device_profiler_text_metric_incubate_quantization_libs_audio_amp_jit. (#46762) --- python/paddle/device/cuda/streams.py | 4 ++-- python/paddle/incubate/autograd/functional.py | 1 - python/paddle/incubate/autograd/primreg.py | 2 -- python/paddle/incubate/autograd/primrules.py | 8 ++++---- .../distributed/models/moe/gate/gshard_gate.py | 1 - .../distributed/models/moe/gate/naive_gate.py | 1 - .../distributed/models/moe/gate/switch_gate.py | 1 - .../distributed/models/moe/grad_clip.py | 5 +---- .../distributed/models/moe/moe_layer.py | 8 -------- .../incubate/multiprocessing/reductions.py | 3 --- .../incubate/nn/functional/fused_matmul_bias.py | 2 +- .../incubate/nn/functional/fused_transformer.py | 4 ++-- .../incubate/nn/layer/fused_transformer.py | 2 -- .../incubate/operators/graph_khop_sampler.py | 4 +--- .../paddle/incubate/operators/graph_reindex.py | 4 +--- .../operators/graph_sample_neighbors.py | 4 +--- .../incubate/operators/graph_send_recv.py | 2 +- python/paddle/incubate/operators/resnet_unit.py | 17 +---------------- .../incubate/operators/softmax_mask_fuse.py | 3 +-- .../softmax_mask_fuse_upper_triangle.py | 3 +-- .../optimizer/distributed_fused_lamb.py | 3 --- .../incubate/optimizer/functional/utils.py | 2 +- python/paddle/incubate/optimizer/lookahead.py | 5 ++--- .../paddle/incubate/optimizer/modelaverage.py | 5 ++--- .../incubate/passes/fuse_resnet_unit_pass.py | 1 - python/paddle/incubate/sparse/binary.py | 2 +- python/paddle/incubate/sparse/creation.py | 4 ++-- python/paddle/incubate/sparse/multiary.py | 2 +- .../incubate/sparse/nn/functional/activation.py | 2 +- .../incubate/sparse/nn/functional/conv.py | 4 +--- .../incubate/sparse/nn/functional/pooling.py | 2 +- .../sparse/nn/functional/transformer.py | 2 +- python/paddle/incubate/sparse/unary.py | 2 +- python/paddle/incubate/xpu/resnet_block.py | 16 ++-------------- python/paddle/metric/metrics.py | 4 ++-- python/paddle/profiler/profiler.py | 4 ++-- python/paddle/profiler/statistic_helper.py | 1 - python/paddle/profiler/timer.py | 1 - python/paddle/text/datasets/conll05.py | 2 -- python/paddle/text/datasets/movielens.py | 4 ---- python/paddle/text/datasets/wmt14.py | 1 - python/paddle/text/viterbi_decode.py | 2 +- 42 files changed, 38 insertions(+), 112 deletions(-) diff --git a/python/paddle/device/cuda/streams.py b/python/paddle/device/cuda/streams.py index d25355056e..573750a862 100644 --- a/python/paddle/device/cuda/streams.py +++ b/python/paddle/device/cuda/streams.py @@ -12,5 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -from paddle.fluid.core import CUDAStream as Stream -from paddle.fluid.core import CUDAEvent as Event +from paddle.fluid.core import CUDAStream as Stream # noqa: F401 +from paddle.fluid.core import CUDAEvent as Event # noqa: F401 diff --git a/python/paddle/incubate/autograd/functional.py b/python/paddle/incubate/autograd/functional.py index b96a4633c1..dce83b7505 100644 --- a/python/paddle/incubate/autograd/functional.py +++ b/python/paddle/incubate/autograd/functional.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import functools import typing import paddle diff --git a/python/paddle/incubate/autograd/primreg.py b/python/paddle/incubate/autograd/primreg.py index 7972409d93..31f47f8196 100644 --- a/python/paddle/incubate/autograd/primreg.py +++ b/python/paddle/incubate/autograd/primreg.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import functools - class Registry(object): """ A general registry object. """ diff --git a/python/paddle/incubate/autograd/primrules.py b/python/paddle/incubate/autograd/primrules.py index 3be0816864..601ed6b0a9 100644 --- a/python/paddle/incubate/autograd/primrules.py +++ b/python/paddle/incubate/autograd/primrules.py @@ -20,15 +20,15 @@ import paddle from . import primops from .primops import (add, broadcast, concat, cos, div, eq, erf, exp, - fill_const, gather, ge, gt, log, matmul, max, mul, ne, - neg, reduce_sum, reshape, scatter_add, select, set_value, - sin, slice_assign, slice_select, split, sqrt, sub, tanh, + fill_const, gather, ge, gt, log, matmul, mul, ne, neg, + reduce_sum, reshape, scatter_add, select, set_value, sin, + slice_assign, slice_select, split, sqrt, sub, tanh, transpose, bernoulli, rsqrt) from .primreg import (REGISTER_JVP, REGISTER_ORIG2PRIM, REGISTER_PRIM2ORIG, REGISTER_TRANSPOSE, lookup_fn, lookup_jvp, lookup_orig2prim, lookup_prim2orig, lookup_transpose, op_position_inputs, op_position_output) -from .utils import INT_DTYPE_2_STRING, get_input_var_list, get_output_var_list +from .utils import INT_DTYPE_2_STRING, get_output_var_list from paddle.fluid.data_feeder import convert_dtype from paddle.fluid.framework import convert_np_dtype_to_dtype_ diff --git a/python/paddle/incubate/distributed/models/moe/gate/gshard_gate.py b/python/paddle/incubate/distributed/models/moe/gate/gshard_gate.py index 643e23feff..4152dee3a3 100644 --- a/python/paddle/incubate/distributed/models/moe/gate/gshard_gate.py +++ b/python/paddle/incubate/distributed/models/moe/gate/gshard_gate.py @@ -22,7 +22,6 @@ import math import paddle import paddle.nn.functional as F -import numpy as np from .naive_gate import NaiveGate from ..utils import limit_by_capacity diff --git a/python/paddle/incubate/distributed/models/moe/gate/naive_gate.py b/python/paddle/incubate/distributed/models/moe/gate/naive_gate.py index 476f99b9f4..20001377fd 100644 --- a/python/paddle/incubate/distributed/models/moe/gate/naive_gate.py +++ b/python/paddle/incubate/distributed/models/moe/gate/naive_gate.py @@ -23,7 +23,6 @@ from .base_gate import BaseGate import paddle import paddle.nn as nn -import paddle.nn.functional as F class NaiveGate(BaseGate): diff --git a/python/paddle/incubate/distributed/models/moe/gate/switch_gate.py b/python/paddle/incubate/distributed/models/moe/gate/switch_gate.py index 6047519854..62e32e4db7 100644 --- a/python/paddle/incubate/distributed/models/moe/gate/switch_gate.py +++ b/python/paddle/incubate/distributed/models/moe/gate/switch_gate.py @@ -21,7 +21,6 @@ import math import paddle -import paddle.nn as nn import paddle.nn.functional as F from .naive_gate import NaiveGate from ..utils import limit_by_capacity diff --git a/python/paddle/incubate/distributed/models/moe/grad_clip.py b/python/paddle/incubate/distributed/models/moe/grad_clip.py index 8d645d8fc0..91de68e4bf 100644 --- a/python/paddle/incubate/distributed/models/moe/grad_clip.py +++ b/python/paddle/incubate/distributed/models/moe/grad_clip.py @@ -14,11 +14,8 @@ from paddle.fluid.clip import ClipGradBase, _squared_l2_norm from paddle.fluid.dygraph import base as imperative_base -from paddle.fluid import core, layers, framework +from paddle.fluid import core, layers from paddle.distributed import collective -import six -import warnings -import copy class ClipGradForMOEByGlobalNorm(ClipGradBase): diff --git a/python/paddle/incubate/distributed/models/moe/moe_layer.py b/python/paddle/incubate/distributed/models/moe/moe_layer.py index 7c11a3e639..b2d11e7a31 100644 --- a/python/paddle/incubate/distributed/models/moe/moe_layer.py +++ b/python/paddle/incubate/distributed/models/moe/moe_layer.py @@ -19,22 +19,14 @@ # Copyright 2021, Jiaao He. All rights reserved. # Licensed under the Apache License, Version 2.0 (the "License"). -import collections -import math - import numpy as np import paddle import paddle.nn as nn -import paddle.nn.functional as F from paddle.distributed.utils.moe_utils import global_scatter, global_gather -from paddle.distributed import alltoall, all_gather -from paddle.distributed.fleet.meta_parallel import get_rng_state_tracker -from paddle.distributed import fleet from paddle.autograd import PyLayer from .gate import NaiveGate, GShardGate, SwitchGate, BaseGate from .utils import count_by_gate -from paddle import fluid from paddle.fluid.framework import in_dygraph_mode from paddle.incubate.distributed.fleet import recompute_hybrid diff --git a/python/paddle/incubate/multiprocessing/reductions.py b/python/paddle/incubate/multiprocessing/reductions.py index 54d4031226..c54626175b 100644 --- a/python/paddle/incubate/multiprocessing/reductions.py +++ b/python/paddle/incubate/multiprocessing/reductions.py @@ -17,13 +17,10 @@ import paddle # TODO: check the hooks of tensor # TODO: check serializing named tensor # TODO: check influence on autograd -import os import sys import warnings -import math import copy import threading -import multiprocessing from multiprocessing.util import register_after_fork from multiprocessing.reduction import ForkingPickler diff --git a/python/paddle/incubate/nn/functional/fused_matmul_bias.py b/python/paddle/incubate/nn/functional/fused_matmul_bias.py index 6d55e31790..6c0722fc70 100644 --- a/python/paddle/incubate/nn/functional/fused_matmul_bias.py +++ b/python/paddle/incubate/nn/functional/fused_matmul_bias.py @@ -15,7 +15,7 @@ from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.framework import _non_static_mode from paddle.tensor.linalg import matmul -from paddle import _C_ops, _legacy_C_ops +from paddle import _legacy_C_ops def fused_matmul_bias(x, diff --git a/python/paddle/incubate/nn/functional/fused_transformer.py b/python/paddle/incubate/nn/functional/fused_transformer.py index 26ac7f3492..2eaa7ceadc 100644 --- a/python/paddle/incubate/nn/functional/fused_transformer.py +++ b/python/paddle/incubate/nn/functional/fused_transformer.py @@ -15,8 +15,8 @@ from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.framework import _non_static_mode, default_main_program from paddle.fluid.data_feeder import check_variable_and_dtype, check_dtype -from paddle.fluid import core, dygraph_utils -from paddle import _C_ops, _legacy_C_ops +from paddle.fluid import core +from paddle import _legacy_C_ops __all__ = [] diff --git a/python/paddle/incubate/nn/layer/fused_transformer.py b/python/paddle/incubate/nn/layer/fused_transformer.py index fefef4f37c..f9cb7da823 100644 --- a/python/paddle/incubate/nn/layer/fused_transformer.py +++ b/python/paddle/incubate/nn/layer/fused_transformer.py @@ -11,10 +11,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from paddle.nn import functional as F from paddle.incubate.nn import functional as incubate_f from paddle.nn import Layer -from paddle.framework import ParamAttr import paddle from paddle.nn.layer.transformer import _convert_attention_mask, _convert_param_attr_to_list from paddle.nn.initializer import Constant diff --git a/python/paddle/incubate/operators/graph_khop_sampler.py b/python/paddle/incubate/operators/graph_khop_sampler.py index 11c9a9853b..2122383381 100644 --- a/python/paddle/incubate/operators/graph_khop_sampler.py +++ b/python/paddle/incubate/operators/graph_khop_sampler.py @@ -12,12 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.framework import _non_static_mode from paddle.fluid.data_feeder import check_variable_and_dtype -from paddle.fluid import core -from paddle import _C_ops, _legacy_C_ops +from paddle import _legacy_C_ops def graph_khop_sampler(row, diff --git a/python/paddle/incubate/operators/graph_reindex.py b/python/paddle/incubate/operators/graph_reindex.py index fee9b170c1..d8f6774190 100644 --- a/python/paddle/incubate/operators/graph_reindex.py +++ b/python/paddle/incubate/operators/graph_reindex.py @@ -12,12 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.framework import _non_static_mode from paddle.fluid.data_feeder import check_variable_and_dtype -from paddle.fluid import core -from paddle import _C_ops, _legacy_C_ops +from paddle import _legacy_C_ops import paddle.utils.deprecated as deprecated diff --git a/python/paddle/incubate/operators/graph_sample_neighbors.py b/python/paddle/incubate/operators/graph_sample_neighbors.py index 8b0d6158b2..b39910f9e1 100644 --- a/python/paddle/incubate/operators/graph_sample_neighbors.py +++ b/python/paddle/incubate/operators/graph_sample_neighbors.py @@ -12,12 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.framework import _non_static_mode from paddle.fluid.data_feeder import check_variable_and_dtype -from paddle.fluid import core -from paddle import _C_ops, _legacy_C_ops +from paddle import _legacy_C_ops import paddle.utils.deprecated as deprecated diff --git a/python/paddle/incubate/operators/graph_send_recv.py b/python/paddle/incubate/operators/graph_send_recv.py index 91ea337eeb..939d8c343f 100644 --- a/python/paddle/incubate/operators/graph_send_recv.py +++ b/python/paddle/incubate/operators/graph_send_recv.py @@ -14,7 +14,7 @@ import numpy as np from paddle.fluid.layer_helper import LayerHelper -from paddle.fluid.framework import _non_static_mode, _in_legacy_dygraph, in_dygraph_mode +from paddle.fluid.framework import _in_legacy_dygraph, in_dygraph_mode from paddle.fluid.framework import Variable from paddle.fluid.data_feeder import check_variable_and_dtype, check_type, check_dtype, convert_dtype from paddle.fluid.layers.tensor import cast diff --git a/python/paddle/incubate/operators/resnet_unit.py b/python/paddle/incubate/operators/resnet_unit.py index 2f4cb4d3bd..c8fb583bff 100644 --- a/python/paddle/incubate/operators/resnet_unit.py +++ b/python/paddle/incubate/operators/resnet_unit.py @@ -12,28 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import copy -import collections -import itertools -import six -import math -import sys -import warnings -from functools import partial, reduce - import numpy as np -import paddle import paddle.fluid as fluid -from paddle import framework -from paddle.device import get_device, get_cudnn_version from paddle.nn import initializer as I -from paddle.nn import Layer, LayerList +from paddle.nn import Layer from paddle.fluid.layers import utils from paddle.fluid.layer_helper import LayerHelper -from paddle.fluid.layers.utils import map_structure, flatten, pack_sequence_as -from paddle.fluid.data_feeder import convert_dtype from paddle.fluid.param_attr import ParamAttr -from paddle import _C_ops, _legacy_C_ops def resnet_unit(x, filter_x, scale_x, bias_x, mean_x, var_x, z, filter_z, diff --git a/python/paddle/incubate/operators/softmax_mask_fuse.py b/python/paddle/incubate/operators/softmax_mask_fuse.py index 4fc733ab4a..27afabaa0d 100644 --- a/python/paddle/incubate/operators/softmax_mask_fuse.py +++ b/python/paddle/incubate/operators/softmax_mask_fuse.py @@ -14,8 +14,7 @@ from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.framework import _non_static_mode -from paddle.fluid import core -from paddle import _C_ops, _legacy_C_ops +from paddle import _legacy_C_ops def softmax_mask_fuse(x, mask, name=None): diff --git a/python/paddle/incubate/operators/softmax_mask_fuse_upper_triangle.py b/python/paddle/incubate/operators/softmax_mask_fuse_upper_triangle.py index 520a6d27e6..d73b8ba6d6 100644 --- a/python/paddle/incubate/operators/softmax_mask_fuse_upper_triangle.py +++ b/python/paddle/incubate/operators/softmax_mask_fuse_upper_triangle.py @@ -14,8 +14,7 @@ from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.framework import _non_static_mode -from paddle.fluid import core -from paddle import _C_ops, _legacy_C_ops +from paddle import _legacy_C_ops def softmax_mask_fuse_upper_triangle(x): diff --git a/python/paddle/incubate/optimizer/distributed_fused_lamb.py b/python/paddle/incubate/optimizer/distributed_fused_lamb.py index 3f3df92be5..56a9a99134 100644 --- a/python/paddle/incubate/optimizer/distributed_fused_lamb.py +++ b/python/paddle/incubate/optimizer/distributed_fused_lamb.py @@ -17,14 +17,11 @@ import paddle from paddle.fluid import framework, core, layers, unique_name from paddle.fluid.framework import Variable from paddle.fluid.clip import ClipGradByGlobalNorm -from paddle.fluid.initializer import Constant from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.optimizer import Optimizer -from paddle.distributed.collective import new_group from paddle.fluid.executor import global_scope from paddle.fluid.framework import name_scope from paddle.fluid import core, unique_name -import numpy as np def init_communicator(block, rank, ranks, ring_id): diff --git a/python/paddle/incubate/optimizer/functional/utils.py b/python/paddle/incubate/optimizer/functional/utils.py index 7a427c4489..e6612878e7 100644 --- a/python/paddle/incubate/optimizer/functional/utils.py +++ b/python/paddle/incubate/optimizer/functional/utils.py @@ -14,7 +14,7 @@ import paddle from paddle.fluid.framework import Variable -from paddle.fluid.data_feeder import check_type, check_dtype +from paddle.fluid.data_feeder import check_type def check_input_type(input, name, op_name): diff --git a/python/paddle/incubate/optimizer/lookahead.py b/python/paddle/incubate/optimizer/lookahead.py index 31ebf9afcc..dcf50cb522 100644 --- a/python/paddle/incubate/optimizer/lookahead.py +++ b/python/paddle/incubate/optimizer/lookahead.py @@ -13,11 +13,10 @@ # limitations under the License. from paddle.optimizer import Optimizer -from paddle.fluid import core, framework, layers, unique_name -from paddle.fluid.framework import Program, Variable, name_scope, default_main_program, default_startup_program, device_guard +from paddle.fluid import framework, layers, unique_name +from paddle.fluid.framework import Variable from paddle.fluid.layer_helper import LayerHelper import paddle -import numpy as np from paddle.fluid.dygraph import base as imperative_base __all__ = [] diff --git a/python/paddle/incubate/optimizer/modelaverage.py b/python/paddle/incubate/optimizer/modelaverage.py index ebbe9cd78f..5fa9dfb67b 100644 --- a/python/paddle/incubate/optimizer/modelaverage.py +++ b/python/paddle/incubate/optimizer/modelaverage.py @@ -13,11 +13,10 @@ # limitations under the License. from paddle.optimizer import Optimizer -from paddle.fluid import core, framework, layers -from paddle.fluid.framework import Program, Variable +from paddle.fluid import framework, layers +from paddle.fluid.framework import Program from paddle.fluid.layer_helper import LayerHelper import paddle -import numpy as np from paddle.fluid.dygraph import base as imperative_base from paddle.fluid.wrapped_decorator import signature_safe_contextmanager from paddle import _C_ops, _legacy_C_ops diff --git a/python/paddle/incubate/passes/fuse_resnet_unit_pass.py b/python/paddle/incubate/passes/fuse_resnet_unit_pass.py index 451ea1908f..fce745ffaf 100644 --- a/python/paddle/incubate/passes/fuse_resnet_unit_pass.py +++ b/python/paddle/incubate/passes/fuse_resnet_unit_pass.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle import paddle.fluid.ir as ir diff --git a/python/paddle/incubate/sparse/binary.py b/python/paddle/incubate/sparse/binary.py index a39a0a756d..c2592e0beb 100644 --- a/python/paddle/incubate/sparse/binary.py +++ b/python/paddle/incubate/sparse/binary.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from paddle import _C_ops, _legacy_C_ops +from paddle import _C_ops from paddle.fluid.framework import dygraph_only, core from paddle import in_dynamic_mode from paddle.fluid.layer_helper import LayerHelper diff --git a/python/paddle/incubate/sparse/creation.py b/python/paddle/incubate/sparse/creation.py index 72f4b3fba6..fe35b9cbd6 100644 --- a/python/paddle/incubate/sparse/creation.py +++ b/python/paddle/incubate/sparse/creation.py @@ -13,11 +13,11 @@ # limitations under the License. import paddle -from paddle import _C_ops, _legacy_C_ops +from paddle import _C_ops from paddle.fluid.framework import core, dygraph_only from paddle.fluid.framework import _current_expected_place, _get_paddle_place from paddle.tensor import to_tensor, max -from paddle.fluid.data_feeder import check_variable_and_dtype, check_type, check_dtype, convert_dtype +from paddle.fluid.data_feeder import convert_dtype from paddle import in_dynamic_mode from paddle.fluid.layer_helper import LayerHelper diff --git a/python/paddle/incubate/sparse/multiary.py b/python/paddle/incubate/sparse/multiary.py index 5389ddc9fa..5a01393077 100644 --- a/python/paddle/incubate/sparse/multiary.py +++ b/python/paddle/incubate/sparse/multiary.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from paddle import _C_ops, _legacy_C_ops +from paddle import _C_ops from paddle.fluid.framework import dygraph_only __all__ = [] diff --git a/python/paddle/incubate/sparse/nn/functional/activation.py b/python/paddle/incubate/sparse/nn/functional/activation.py index 7cc6920b39..0e83abd239 100644 --- a/python/paddle/incubate/sparse/nn/functional/activation.py +++ b/python/paddle/incubate/sparse/nn/functional/activation.py @@ -14,7 +14,7 @@ __all__ = [] -from paddle import _C_ops, _legacy_C_ops +from paddle import _C_ops from paddle.fluid.framework import dygraph_only from paddle import in_dynamic_mode from paddle.fluid.layer_helper import LayerHelper diff --git a/python/paddle/incubate/sparse/nn/functional/conv.py b/python/paddle/incubate/sparse/nn/functional/conv.py index d8cece7cde..233af394ec 100644 --- a/python/paddle/incubate/sparse/nn/functional/conv.py +++ b/python/paddle/incubate/sparse/nn/functional/conv.py @@ -14,10 +14,8 @@ __all__ = [] -from paddle import _C_ops, _legacy_C_ops, in_dynamic_mode +from paddle import _C_ops, in_dynamic_mode from paddle.fluid.layers.utils import convert_to_list -from paddle.fluid.layers.nn import elementwise_add -from ...creation import sparse_coo_tensor from ...binary import add from paddle.nn.functional.conv import _update_padding_nd from paddle.fluid.layer_helper import LayerHelper diff --git a/python/paddle/incubate/sparse/nn/functional/pooling.py b/python/paddle/incubate/sparse/nn/functional/pooling.py index 6acd303d0f..aedadc8e56 100644 --- a/python/paddle/incubate/sparse/nn/functional/pooling.py +++ b/python/paddle/incubate/sparse/nn/functional/pooling.py @@ -13,7 +13,7 @@ # limitations under the License. from paddle.fluid.layers import utils -from paddle import _C_ops, _legacy_C_ops, in_dynamic_mode +from paddle import _C_ops, in_dynamic_mode from paddle.nn.functional.pooling import _update_padding_nd __all__ = [] diff --git a/python/paddle/incubate/sparse/nn/functional/transformer.py b/python/paddle/incubate/sparse/nn/functional/transformer.py index 0ed230aa23..26164720cd 100644 --- a/python/paddle/incubate/sparse/nn/functional/transformer.py +++ b/python/paddle/incubate/sparse/nn/functional/transformer.py @@ -14,7 +14,7 @@ __all__ = [] -from paddle import _C_ops, _legacy_C_ops +from paddle import _C_ops from paddle.fluid.framework import dygraph_only diff --git a/python/paddle/incubate/sparse/unary.py b/python/paddle/incubate/sparse/unary.py index 7090ef44c7..319f64118b 100644 --- a/python/paddle/incubate/sparse/unary.py +++ b/python/paddle/incubate/sparse/unary.py @@ -14,7 +14,7 @@ import numpy as np -from paddle import _C_ops, _legacy_C_ops +from paddle import _C_ops from paddle.fluid.framework import dygraph_only, core, convert_np_dtype_to_dtype_ __all__ = [] diff --git a/python/paddle/incubate/xpu/resnet_block.py b/python/paddle/incubate/xpu/resnet_block.py index c584766730..1eb3637fa5 100644 --- a/python/paddle/incubate/xpu/resnet_block.py +++ b/python/paddle/incubate/xpu/resnet_block.py @@ -12,26 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import copy -import collections -import itertools -import six -import math -import sys -import warnings -from functools import partial, reduce - import numpy as np -import paddle import paddle.fluid as fluid -from paddle import framework from paddle.nn import initializer as I -from paddle.nn import Layer, LayerList +from paddle.nn import Layer from paddle.fluid.layers import utils from paddle.fluid.layer_helper import LayerHelper -from paddle.fluid.data_feeder import convert_dtype from paddle.fluid.param_attr import ParamAttr -from paddle import _C_ops, _legacy_C_ops +from paddle import _legacy_C_ops __all__ = ['resnet_basic_block', 'ResNetBasicBlock'] diff --git a/python/paddle/metric/metrics.py b/python/paddle/metric/metrics.py index aeec4022e2..a7d8da75fe 100644 --- a/python/paddle/metric/metrics.py +++ b/python/paddle/metric/metrics.py @@ -18,9 +18,9 @@ import numpy as np from ..fluid.data_feeder import check_variable_and_dtype from ..fluid.layer_helper import LayerHelper -from ..fluid.framework import core, _varbase_creator, _non_static_mode, _in_legacy_dygraph +from ..fluid.framework import _non_static_mode, _varbase_creator import paddle -from paddle import _C_ops, _legacy_C_ops +from paddle import _legacy_C_ops __all__ = [] diff --git a/python/paddle/profiler/profiler.py b/python/paddle/profiler/profiler.py index dcfeebcdc3..e4c32db2e9 100644 --- a/python/paddle/profiler/profiler.py +++ b/python/paddle/profiler/profiler.py @@ -22,8 +22,8 @@ import importlib import json import paddle -from paddle.fluid.core import (_Profiler, _ProfilerResult, ProfilerOptions, - TracerEventType, enable_memory_recorder, +from paddle.fluid.core import (_Profiler, ProfilerOptions, TracerEventType, + enable_memory_recorder, enable_input_shape_recorder, disable_memory_recorder, disable_input_shape_recorder) diff --git a/python/paddle/profiler/statistic_helper.py b/python/paddle/profiler/statistic_helper.py index 358f2a09b9..b6925a2b77 100644 --- a/python/paddle/profiler/statistic_helper.py +++ b/python/paddle/profiler/statistic_helper.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import collections def sum_ranges(ranges): diff --git a/python/paddle/profiler/timer.py b/python/paddle/profiler/timer.py index 5fcc251510..1f0fb6acde 100644 --- a/python/paddle/profiler/timer.py +++ b/python/paddle/profiler/timer.py @@ -13,7 +13,6 @@ # limitations under the License. import timeit -import logging from collections import OrderedDict diff --git a/python/paddle/text/datasets/conll05.py b/python/paddle/text/datasets/conll05.py index 36bb6e5357..3e8889a126 100644 --- a/python/paddle/text/datasets/conll05.py +++ b/python/paddle/text/datasets/conll05.py @@ -15,8 +15,6 @@ import gzip import tarfile import numpy as np -import six -from six.moves import cPickle as pickle from paddle.io import Dataset import paddle.compat as cpt diff --git a/python/paddle/text/datasets/movielens.py b/python/paddle/text/datasets/movielens.py index abf27db6b3..c3d1de135b 100644 --- a/python/paddle/text/datasets/movielens.py +++ b/python/paddle/text/datasets/movielens.py @@ -15,11 +15,7 @@ import numpy as np import zipfile import re -import random -import functools -import six -import paddle from paddle.io import Dataset import paddle.compat as cpt from paddle.dataset.common import _check_exists_and_download diff --git a/python/paddle/text/datasets/wmt14.py b/python/paddle/text/datasets/wmt14.py index 3266a68c0c..bfb665570c 100644 --- a/python/paddle/text/datasets/wmt14.py +++ b/python/paddle/text/datasets/wmt14.py @@ -14,7 +14,6 @@ import tarfile import numpy as np -import gzip import six from paddle.io import Dataset diff --git a/python/paddle/text/viterbi_decode.py b/python/paddle/text/viterbi_decode.py index aa289a270c..a2a92da947 100644 --- a/python/paddle/text/viterbi_decode.py +++ b/python/paddle/text/viterbi_decode.py @@ -13,7 +13,7 @@ # limitations under the License. from ..nn import Layer -from ..fluid.framework import core, _non_static_mode, in_dygraph_mode +from ..fluid.framework import _non_static_mode, in_dygraph_mode from ..fluid.layer_helper import LayerHelper from ..fluid.data_feeder import check_variable_and_dtype, check_type from paddle import _C_ops, _legacy_C_ops -- GitLab