diff --git a/python/paddle/dataset/cifar.py b/python/paddle/dataset/cifar.py index f9fffe30477bdbc120332866e94202979440ebfa..579422887fe84a2b7a02de045d94b0b518f15a16 100644 --- a/python/paddle/dataset/cifar.py +++ b/python/paddle/dataset/cifar.py @@ -27,7 +27,6 @@ images per class. """ -import itertools import numpy import paddle.dataset.common import paddle.utils.deprecated as deprecated diff --git a/python/paddle/dataset/common.py b/python/paddle/dataset/common.py index 570704af73d03d4bf22b0c08ea09fd18a64b5402..a7aa2716917fd986091139fdb80ec01f41b865fe 100644 --- a/python/paddle/dataset/common.py +++ b/python/paddle/dataset/common.py @@ -17,7 +17,6 @@ import hashlib import os import errno import shutil -import six import sys import importlib import paddle.dataset @@ -55,7 +54,6 @@ def must_mkdirs(path): except OSError as exc: if exc.errno != errno.EEXIST: raise - pass must_mkdirs(DATA_HOME) diff --git a/python/paddle/dataset/conll05.py b/python/paddle/dataset/conll05.py index 2ddc3e4edc614ccece306d6f637a058201e02275..b98b5d4bde6f06da6ee2b38b6c1de47a6986fd39 100644 --- a/python/paddle/dataset/conll05.py +++ b/python/paddle/dataset/conll05.py @@ -22,7 +22,6 @@ to initialize SRL model. import tarfile import gzip -import itertools import paddle.dataset.common import paddle.compat as cpt import paddle.utils.deprecated as deprecated diff --git a/python/paddle/dataset/flowers.py b/python/paddle/dataset/flowers.py index d905866e0f3ce8ceb420fdbc8863e4ac018e0a0a..42c0e7081d58efe7e45c750cd55f55335995d3ad 100644 --- a/python/paddle/dataset/flowers.py +++ b/python/paddle/dataset/flowers.py @@ -29,24 +29,16 @@ http://www.robots.ox.ac.uk/~vgg/publications/papers/nilsback08.{pdf,ps.gz}. """ -import itertools import functools from .common import download import tarfile from paddle.dataset.image import load_image_bytes -from paddle.dataset.image import load_image from paddle.dataset.image import simple_transform -from paddle.dataset.image import batch_images_from_tar from paddle.reader import map_readers, xmap_readers -from paddle import compat as cpt import paddle.utils.deprecated as deprecated -import os -import numpy as np from multiprocessing import cpu_count -import six -from six.moves import cPickle as pickle from paddle.utils import try_import __all__ = [] diff --git a/python/paddle/dataset/movielens.py b/python/paddle/dataset/movielens.py index f6dd853cc4e4bbedf9981c0e03742b0e2cfb0266..590d20b741fd350b3c1adc0846f8e93115cc9de8 100644 --- a/python/paddle/dataset/movielens.py +++ b/python/paddle/dataset/movielens.py @@ -27,7 +27,6 @@ import zipfile import paddle.dataset.common import paddle.utils.deprecated as deprecated import re -import random import functools import six import paddle.compat as cpt diff --git a/python/paddle/dataset/wmt14.py b/python/paddle/dataset/wmt14.py index d71f2b6854917462bcb01b572370da13240393a4..cdc516bee2d24fecaa30298885ae07b70d5eb419 100644 --- a/python/paddle/dataset/wmt14.py +++ b/python/paddle/dataset/wmt14.py @@ -22,7 +22,6 @@ parse training set and test set into paddle reader creators. import six import tarfile -import gzip import paddle.dataset.common import paddle.compat as cpt diff --git a/python/paddle/dataset/wmt16.py b/python/paddle/dataset/wmt16.py index 454c751f1ddf4d0070450bb4580e985e81e102f1..cc3857aca982a868ddaadd5be7b02e50274e7d67 100644 --- a/python/paddle/dataset/wmt16.py +++ b/python/paddle/dataset/wmt16.py @@ -31,7 +31,6 @@ Multi30K: Multilingual English-German Image Descriptions. import os import six import tarfile -import gzip from collections import defaultdict import paddle diff --git a/python/paddle/distribution/categorical.py b/python/paddle/distribution/categorical.py index 7728f063c04c2f77f553bec76cfe92ae4d2694b5..269e2b5567196883f363fcc1baa223ef62f173e4 100644 --- a/python/paddle/distribution/categorical.py +++ b/python/paddle/distribution/categorical.py @@ -12,21 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import math -import warnings - import numpy as np import paddle -from paddle import _C_ops, _legacy_C_ops from paddle.distribution import distribution -from paddle.fluid import core -from paddle.fluid.data_feeder import (check_dtype, check_type, - check_variable_and_dtype, convert_dtype) -from paddle.fluid.framework import _non_static_mode, in_dygraph_mode -from paddle.fluid.layers import (control_flow, elementwise_add, elementwise_div, - elementwise_mul, elementwise_sub, nn, ops, - tensor) -from paddle.tensor import arange, concat, gather_nd, multinomial +from paddle.fluid.data_feeder import (check_type, convert_dtype) +from paddle.fluid.framework import _non_static_mode +from paddle.fluid.layers import (ops, tensor) +from paddle.tensor import multinomial class Categorical(distribution.Distribution): diff --git a/python/paddle/distribution/distribution.py b/python/paddle/distribution/distribution.py index d4fb4bffc841d45e649975e861469028eb8976da..14861d3794e3217de549011d3c5ec88805b97d7f 100644 --- a/python/paddle/distribution/distribution.py +++ b/python/paddle/distribution/distribution.py @@ -19,20 +19,14 @@ # 'sampling_id', # 'Uniform'] -import math import warnings import numpy as np import paddle from paddle import _C_ops, _legacy_C_ops -from paddle.fluid import core -from paddle.fluid.data_feeder import (check_dtype, check_type, - check_variable_and_dtype, convert_dtype) +from paddle.fluid.data_feeder import (check_variable_and_dtype, convert_dtype) from paddle.fluid.framework import _non_static_mode, in_dygraph_mode, _in_legacy_dygraph -from paddle.fluid.layers import (control_flow, elementwise_add, elementwise_div, - elementwise_mul, elementwise_sub, nn, ops, - tensor) -from paddle.tensor import arange, concat, gather_nd, multinomial +from paddle.fluid.layers import tensor class Distribution(object): diff --git a/python/paddle/distribution/exponential_family.py b/python/paddle/distribution/exponential_family.py index 63019667fffa84e4b5b0d1806f308958e31acfcc..301c0cea13a582d31228cdc75a0c89c630223e70 100644 --- a/python/paddle/distribution/exponential_family.py +++ b/python/paddle/distribution/exponential_family.py @@ -14,7 +14,7 @@ import paddle from paddle.distribution import distribution -from paddle.fluid.framework import _non_static_mode, in_dygraph_mode +from paddle.fluid.framework import _non_static_mode class ExponentialFamily(distribution.Distribution): diff --git a/python/paddle/distribution/kl.py b/python/paddle/distribution/kl.py index 80a093ad8b4915395d21f6929c6fb3dca6cc052f..aa288a57ba0b77deca879c70f40223443a259b0a 100644 --- a/python/paddle/distribution/kl.py +++ b/python/paddle/distribution/kl.py @@ -24,7 +24,7 @@ from paddle.distribution.normal import Normal from paddle.distribution.lognormal import LogNormal from paddle.distribution.uniform import Uniform from paddle.distribution.laplace import Laplace -from paddle.fluid.framework import _non_static_mode, in_dygraph_mode +from paddle.fluid.framework import _non_static_mode __all__ = ["register_kl", "kl_divergence"] diff --git a/python/paddle/distribution/multinomial.py b/python/paddle/distribution/multinomial.py index d960c6d8f6bbe9d3c497820f55ce21a2b1152cd4..22f8aa820f9936f69491531f4645e847f7db62ec 100644 --- a/python/paddle/distribution/multinomial.py +++ b/python/paddle/distribution/multinomial.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import collections - import paddle from paddle.distribution import categorical, distribution try: diff --git a/python/paddle/distribution/normal.py b/python/paddle/distribution/normal.py index 33e36fbe72dac69bf76ded1ca35417e66db6d6c7..f76f13b250e4c82e149352b580a2cf76e6eddf1f 100644 --- a/python/paddle/distribution/normal.py +++ b/python/paddle/distribution/normal.py @@ -13,19 +13,13 @@ # limitations under the License. import math -import warnings - import numpy as np import paddle -from paddle import _C_ops, _legacy_C_ops from paddle.distribution import distribution -from paddle.fluid import core -from paddle.fluid.data_feeder import (check_dtype, check_type, - check_variable_and_dtype, convert_dtype) -from paddle.fluid.framework import _non_static_mode, in_dygraph_mode -from paddle.fluid.layers import (control_flow, elementwise_add, elementwise_div, - elementwise_mul, elementwise_sub, nn, ops, - tensor) +from paddle.fluid.data_feeder import (check_type, convert_dtype) +from paddle.fluid.framework import _non_static_mode +from paddle.fluid.layers import (elementwise_add, elementwise_div, + elementwise_sub, nn, ops, tensor) try: from collections.abc import Iterable except: diff --git a/python/paddle/distribution/transform.py b/python/paddle/distribution/transform.py index ff2e13f94acf97387deed2dd70b5c5c48318518a..6cb0e048bab7e7219f2397cbd2351f36d7585d4d 100644 --- a/python/paddle/distribution/transform.py +++ b/python/paddle/distribution/transform.py @@ -15,7 +15,6 @@ import enum import functools import math -import numbers import operator import typing diff --git a/python/paddle/distribution/uniform.py b/python/paddle/distribution/uniform.py index 961d846a527c65f5aa6324e703d7749cbcc578b9..3c5655b27a4e62cf06dfe7f68200e8cb115efbee 100644 --- a/python/paddle/distribution/uniform.py +++ b/python/paddle/distribution/uniform.py @@ -12,20 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import math -import warnings - import numpy as np from paddle import _C_ops, _legacy_C_ops from paddle.distribution import distribution -from paddle.fluid import core -from paddle.fluid.data_feeder import (check_dtype, check_type, - check_variable_and_dtype, convert_dtype) +from paddle.fluid.data_feeder import (check_type, convert_dtype) from paddle.fluid.framework import _non_static_mode, in_dygraph_mode, _in_legacy_dygraph -from paddle.fluid.layers import (control_flow, elementwise_add, elementwise_div, - elementwise_mul, elementwise_sub, nn, ops, - tensor) -from paddle.tensor import arange, concat, gather_nd, multinomial +from paddle.fluid.layers import (elementwise_add, elementwise_div, + elementwise_sub, nn, tensor) class Uniform(distribution.Distribution): diff --git a/python/paddle/nn/functional/activation.py b/python/paddle/nn/functional/activation.py index 90a3748cd324d6776b4ea2031a11fc04c6231644..bcde1f064962bc25da2ca39390af2073bdc48ef6 100644 --- a/python/paddle/nn/functional/activation.py +++ b/python/paddle/nn/functional/activation.py @@ -18,12 +18,10 @@ from ...tensor.math import tanh_ # noqa: F401 from ...fluid.dygraph.inplace_utils import inplace_apis_in_dygraph_only from ...tensor.manipulation import chunk -from ...tensor.math import multiply -import warnings from ...fluid.layer_helper import LayerHelper from ...fluid.framework import convert_np_dtype_to_dtype_ -from ...fluid.framework import _in_legacy_dygraph, in_dygraph_mode, _non_static_mode +from ...fluid.framework import _in_legacy_dygraph, in_dygraph_mode from ...fluid.data_feeder import check_variable_and_dtype, check_dtype import paddle from paddle import _C_ops, _legacy_C_ops, in_dynamic_mode diff --git a/python/paddle/nn/functional/common.py b/python/paddle/nn/functional/common.py index 34818152f9a59130f52920c45b989855174b072f..2dc4db3026557e096e5eebd85ac71a5c19000179 100644 --- a/python/paddle/nn/functional/common.py +++ b/python/paddle/nn/functional/common.py @@ -12,14 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import warnings import paddle from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.layers.tensor import fill_constant from ...tensor import concat from ...tensor.creation import zeros from paddle.static import Variable -from ...fluid import dygraph_utils # TODO: define the common functions to build a neural network from ...tensor.manipulation import squeeze from ...tensor.manipulation import unsqueeze @@ -27,9 +25,7 @@ from ...tensor import clip from ...tensor import sum from ...tensor import sqrt from ...fluid.data_feeder import check_variable_and_dtype, check_dtype, check_type -from ...fluid.framework import _varbase_creator, _in_legacy_dygraph, in_dygraph_mode, _non_static_mode - -from ...fluid import dygraph_utils +from ...fluid.framework import _in_legacy_dygraph, _non_static_mode, in_dygraph_mode from paddle import _C_ops, _legacy_C_ops from paddle.framework import in_dynamic_mode diff --git a/python/paddle/nn/functional/conv.py b/python/paddle/nn/functional/conv.py index eacc22975f1e0a72a05896d32f34410a7d0b8914..17eded8ac06a8465c88cb4d6d60d9eecea628acb 100644 --- a/python/paddle/nn/functional/conv.py +++ b/python/paddle/nn/functional/conv.py @@ -12,16 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import numpy as np from ...device import get_cudnn_version from ...static import Variable -from ...fluid import dygraph_utils from ...fluid.layers.utils import convert_to_list, _is_symmetric_padding, _contain_var, _convert_to_tensor_list from ...fluid.data_feeder import check_variable_and_dtype, check_dtype -from ...framework import ParamAttr from ...fluid.layer_helper import LayerHelper from ...tensor.manipulation import unsqueeze, squeeze -from ...tensor.math import add from ...fluid.layers import nn from paddle import _C_ops, _legacy_C_ops from paddle import get_flags @@ -34,7 +30,6 @@ from paddle.device import is_compiled_with_rocm from paddle.fluid.framework import _global_flags from paddle.fluid.framework import _in_legacy_dygraph from paddle.fluid.framework import in_dygraph_mode -from paddle.fluid.framework import _non_static_mode __all__ = [] diff --git a/python/paddle/nn/functional/extension.py b/python/paddle/nn/functional/extension.py index 682fa616d63a131d9fcfd4593204084f9bac8a4a..de3ffdf2bc8398ca603499d851a7ff472a8d7e1d 100644 --- a/python/paddle/nn/functional/extension.py +++ b/python/paddle/nn/functional/extension.py @@ -19,7 +19,6 @@ from ...fluid.data_feeder import check_dtype from ...fluid.layer_helper import LayerHelper from ...static import Variable from ...tensor.creation import assign -from ...fluid import dygraph_utils from ...tensor.layer_function_generator import templatedoc from paddle import in_dynamic_mode from paddle import _C_ops, _legacy_C_ops diff --git a/python/paddle/nn/functional/input.py b/python/paddle/nn/functional/input.py index 57d4d8e39e3f67eeb0adf0cfa8d2adae0ad44c98..8df602e5c776d16d7dcde09be6f7bd0c12428888 100644 --- a/python/paddle/nn/functional/input.py +++ b/python/paddle/nn/functional/input.py @@ -12,12 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import warnings from ...static import Variable from ...fluid.layer_helper import LayerHelper -from ...fluid.data_feeder import check_variable_and_dtype, check_dtype +from ...fluid.data_feeder import check_variable_and_dtype from paddle import _C_ops, _legacy_C_ops -from paddle import in_dynamic_mode from ...fluid.framework import _in_legacy_dygraph, in_dygraph_mode __all__ = [] diff --git a/python/paddle/nn/functional/loss.py b/python/paddle/nn/functional/loss.py index b084b7db22a7a0c17a036a0d657cab401a025683..20b699c7a2798d2d60cca2528c586c292804e5e4 100755 --- a/python/paddle/nn/functional/loss.py +++ b/python/paddle/nn/functional/loss.py @@ -17,7 +17,6 @@ import paddle from ...fluid.data_feeder import check_variable_and_dtype # TODO: define loss functions of neural network -import numpy as np import paddle import paddle.fluid as fluid from ...fluid.layers.nn import _elementwise_op_in_dygraph diff --git a/python/paddle/nn/functional/norm.py b/python/paddle/nn/functional/norm.py index 2b3517c900a5bb2cacf74c7f0fb7bc608601947b..d62dcdcfbf4f4059059019dc9e6d68afd5c8ee69 100644 --- a/python/paddle/nn/functional/norm.py +++ b/python/paddle/nn/functional/norm.py @@ -17,14 +17,11 @@ import paddle import paddle.fluid as fluid from ...fluid.data_feeder import check_variable_and_dtype, check_type from ...fluid.layer_helper import LayerHelper -from ...framework import create_parameter -from ..initializer import Constant -from ...framework import ParamAttr from ...fluid import dygraph_utils import numbers from paddle import _C_ops, _legacy_C_ops from paddle import in_dynamic_mode -from paddle.fluid.framework import core, _non_static_mode, in_dygraph_mode, _in_legacy_dygraph +from paddle.fluid.framework import _in_legacy_dygraph, in_dygraph_mode __all__ = [] diff --git a/python/paddle/nn/functional/pooling.py b/python/paddle/nn/functional/pooling.py index f3605b0f72bd67068e1b6202bf65e5d851ad1975..43c53c56e45e919876949dfa8ba1ac1687ad7e05 100755 --- a/python/paddle/nn/functional/pooling.py +++ b/python/paddle/nn/functional/pooling.py @@ -18,7 +18,6 @@ from ...tensor.manipulation import unsqueeze, squeeze from ...fluid.data_feeder import check_type, check_variable_and_dtype from paddle import _C_ops, _legacy_C_ops from paddle import in_dynamic_mode -from paddle.fluid import core from paddle.fluid.framework import _in_legacy_dygraph, Variable from paddle.fluid.framework import in_dygraph_mode, _non_static_mode diff --git a/python/paddle/nn/functional/sparse_attention.py b/python/paddle/nn/functional/sparse_attention.py index cf5db83077eabc61bc3d369db4253befc6da6f55..87df72fe0ef2f3edd080cda9e8f89ae96c5c6d48 100644 --- a/python/paddle/nn/functional/sparse_attention.py +++ b/python/paddle/nn/functional/sparse_attention.py @@ -12,11 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import warnings -import paddle -from ...fluid.framework import default_main_program from paddle.fluid.layer_helper import LayerHelper -from paddle import _C_ops, _legacy_C_ops +from paddle import _legacy_C_ops from paddle import in_dynamic_mode diff --git a/python/paddle/nn/functional/vision.py b/python/paddle/nn/functional/vision.py index 7f7a18d0a2ed27dcbebbbba9141b8b4e8f4aa2c8..af1656d641740b223f82a3e0ed393133adcdffe8 100644 --- a/python/paddle/nn/functional/vision.py +++ b/python/paddle/nn/functional/vision.py @@ -16,8 +16,6 @@ from ...device import get_cudnn_version from ...static import Variable from ...fluid.layer_helper import LayerHelper from ...fluid.data_feeder import check_variable_and_dtype -from ...fluid import dygraph_utils -import numpy as np from paddle import _C_ops, _legacy_C_ops from ...device import is_compiled_with_rocm from paddle import in_dynamic_mode diff --git a/python/paddle/nn/initializer/dirac.py b/python/paddle/nn/initializer/dirac.py index 26b2e4503713af4fdea7f19a22d7b416d7d34fc0..74fc285c6bbf3d46d9017503de6039cf1d67742c 100644 --- a/python/paddle/nn/initializer/dirac.py +++ b/python/paddle/nn/initializer/dirac.py @@ -19,7 +19,7 @@ from ...fluid import framework from ...fluid.framework import _current_expected_place from paddle import in_dynamic_mode from paddle.utils import unique_name -from paddle import _C_ops, _legacy_C_ops +from paddle import _C_ops from ... import fluid __all__ = [] diff --git a/python/paddle/nn/initializer/orthogonal.py b/python/paddle/nn/initializer/orthogonal.py index b8fe912a8399e7047470c6fdc9926a9c792174c2..65871ebad0b503613c0963bfeb0ae8762ead583d 100644 --- a/python/paddle/nn/initializer/orthogonal.py +++ b/python/paddle/nn/initializer/orthogonal.py @@ -15,10 +15,9 @@ from ...fluid.initializer import Initializer from ...fluid.data_feeder import check_variable_and_dtype from ...fluid import framework -from ...tensor import diag, transpose, sign, qr, reshape from paddle.utils import unique_name from ...fluid.dygraph import no_grad -from paddle import _C_ops, _legacy_C_ops +from paddle import _C_ops __all__ = [] diff --git a/python/paddle/nn/layer/activation.py b/python/paddle/nn/layer/activation.py index e397f40c82369a55e933c4218babf8a49281b47c..2382acbd0cab0a831b83c0b1b635a7bace2b8084 100644 --- a/python/paddle/nn/layer/activation.py +++ b/python/paddle/nn/layer/activation.py @@ -14,7 +14,6 @@ # TODO: define activation functions of neural network -from ...framework import ParamAttr from ..initializer import Constant from paddle.framework import get_default_dtype from .. import functional as F diff --git a/python/paddle/nn/layer/common.py b/python/paddle/nn/layer/common.py index 0bbcac444eb4634d1f9232f3ec773ebf41c4aac3..6cc2056459f81a8cbb1876b7134f2f5d3507e9ac 100644 --- a/python/paddle/nn/layer/common.py +++ b/python/paddle/nn/layer/common.py @@ -16,7 +16,6 @@ import paddle from ...fluid.dygraph import Flatten # noqa: F401 from .. import functional as F -from ...fluid.framework import _dygraph_tracer from paddle.nn import Layer from paddle import in_dynamic_mode diff --git a/python/paddle/nn/layer/loss.py b/python/paddle/nn/layer/loss.py index 8c80a82265f716d8c4a029c4484facfd1844d663..fea2add79b48d016b5cbb9da3e71607f1974a441 100644 --- a/python/paddle/nn/layer/loss.py +++ b/python/paddle/nn/layer/loss.py @@ -14,11 +14,10 @@ # limitations under the License. # TODO: define loss functions of neural network -import numpy as np import paddle.fluid as fluid import paddle from .. import functional as F -from paddle.fluid.framework import _varbase_creator, in_dygraph_mode, _in_legacy_dygraph +from paddle.fluid.framework import in_dygraph_mode from .. import Layer from paddle import in_dynamic_mode diff --git a/python/paddle/nn/layer/norm.py b/python/paddle/nn/layer/norm.py index fe553fd2741453310badc3460cd3be5fecb5ec8b..d011bfd34aa8a95ead0cb25c916314b2606e4b39 100644 --- a/python/paddle/nn/layer/norm.py +++ b/python/paddle/nn/layer/norm.py @@ -27,16 +27,14 @@ # TODO: define normalization api -import six - from ...fluid.dygraph import BatchNorm # noqa: F401 from ...fluid.dygraph import SpectralNorm # noqa: F401 -from ...framework import get_default_dtype, set_default_dtype, _non_static_mode +from ...framework import get_default_dtype from ..initializer import Constant from ...framework import ParamAttr -from ...fluid.data_feeder import check_variable_and_dtype, check_type +from ...fluid.data_feeder import check_variable_and_dtype from ...fluid import dygraph_utils from ..functional import batch_norm, layer_norm, instance_norm diff --git a/python/paddle/nn/layer/pooling.py b/python/paddle/nn/layer/pooling.py index 68d5fa553b6d0fb6bc28b6cc22a3e0732a2bb424..3e47275410d09be16903d05c0be70b95edea32b1 100755 --- a/python/paddle/nn/layer/pooling.py +++ b/python/paddle/nn/layer/pooling.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ...fluid.layer_helper import LayerHelper from .. import functional as F from .. import Layer diff --git a/python/paddle/nn/layer/rnn.py b/python/paddle/nn/layer/rnn.py index f1b728d7bb2b0c01834ab7af98a42939f8844728..f4e70f2bd1688a77e4cae08bc6a9c51da9093617 100644 --- a/python/paddle/nn/layer/rnn.py +++ b/python/paddle/nn/layer/rnn.py @@ -12,26 +12,19 @@ # 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 +from functools import 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 functional as F from paddle.nn import initializer as I from paddle.nn import Layer, LayerList from paddle.fluid.layers import utils -from paddle.fluid.layers.utils import map_structure, flatten, pack_sequence_as -from paddle.fluid.data_feeder import convert_dtype +from paddle.fluid.layers.utils import flatten, map_structure from paddle import _C_ops, _legacy_C_ops from paddle import in_dynamic_mode from paddle.fluid.framework import in_dygraph_mode diff --git a/python/paddle/nn/quant/lsq.py b/python/paddle/nn/quant/lsq.py index f92b3856dd39d66dcee30b35f45b08eed166561f..6ed6e78a6d98eee1413f449efae7dfc2d2007516 100644 --- a/python/paddle/nn/quant/lsq.py +++ b/python/paddle/nn/quant/lsq.py @@ -13,21 +13,12 @@ # limitations under the License. import paddle -from paddle.framework import core -from paddle.fluid import dygraph_utils from paddle.utils import unique_name from paddle.framework import ParamAttr -from paddle.fluid.framework import _varbase_creator from paddle.nn.initializer import Constant -from paddle.fluid.data_feeder import check_variable_and_dtype -from paddle.nn import functional as F -import logging -from paddle.fluid.log_helper import get_logger -from paddle import in_dynamic_mode from paddle.nn import Layer from paddle.autograd import PyLayer import math -import copy def round(x): diff --git a/python/paddle/nn/quant/quant_layers.py b/python/paddle/nn/quant/quant_layers.py index 855a05383775c82c6fb857609a1c41034dd959e2..affa180bd303a8fac804d8c845d7c7e798d0788f 100644 --- a/python/paddle/nn/quant/quant_layers.py +++ b/python/paddle/nn/quant/quant_layers.py @@ -14,7 +14,6 @@ import paddle from paddle.framework import core -from paddle.fluid import dygraph_utils from paddle.utils import unique_name from paddle.framework import ParamAttr from paddle.fluid.framework import _varbase_creator @@ -23,7 +22,7 @@ from paddle.fluid.data_feeder import check_variable_and_dtype from paddle.nn import functional as F import logging from paddle.fluid.log_helper import get_logger -from paddle import _C_ops, _legacy_C_ops +from paddle import _legacy_C_ops from paddle import in_dynamic_mode from paddle.nn import Layer from paddle.nn.quant.lsq import FakeQuantActLSQPlus, FakeQuantWeightLSQPlus diff --git a/python/paddle/nn/utils/spectral_norm_hook.py b/python/paddle/nn/utils/spectral_norm_hook.py index 4cde491a15fa8581965a3b0c2e5aed783326584f..a2a93d3241e3de4709dfcd91776d1188f93d6a16 100644 --- a/python/paddle/nn/utils/spectral_norm_hook.py +++ b/python/paddle/nn/utils/spectral_norm_hook.py @@ -12,9 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import math -import numpy as np - import paddle from ..layer.conv import Conv1DTranspose, Conv2DTranspose, Conv3DTranspose from ..layer.common import Linear diff --git a/python/paddle/nn/utils/transform_parameters.py b/python/paddle/nn/utils/transform_parameters.py index bc813ccad24e919f8b52200a8110e30a402c7d0b..63ddd0974446abc2a01f860699d6eb6f576b0f8e 100644 --- a/python/paddle/nn/utils/transform_parameters.py +++ b/python/paddle/nn/utils/transform_parameters.py @@ -16,7 +16,7 @@ from functools import reduce import paddle from paddle.fluid.framework import dygraph_only, _dygraph_tracer, _varbase_creator, in_dygraph_mode -from paddle import _C_ops, _legacy_C_ops +from paddle import _C_ops #input==output, inplace strategy of reshape has no cost almostly diff --git a/python/paddle/nn/utils/weight_norm_hook.py b/python/paddle/nn/utils/weight_norm_hook.py index d2b0806712281fc12d9d2d58bcb708b274a2a822..b836ad2843907003ddca5f33297f7a765b3bb4b8 100755 --- a/python/paddle/nn/utils/weight_norm_hook.py +++ b/python/paddle/nn/utils/weight_norm_hook.py @@ -12,14 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. import paddle -import numpy as np -from ... import fluid -from ...fluid import dygraph from ...fluid import layers as F from ...fluid.layer_helper import LayerHelper from ...fluid.data_feeder import check_variable_and_dtype from ...framework import in_dygraph_mode -from paddle import _C_ops, _legacy_C_ops +from paddle import _C_ops __all__ = [] diff --git a/python/paddle/reader/decorator.py b/python/paddle/reader/decorator.py index 1104ba5a29b311344be48892f5d0b298f76a3703..0c41ae4909f0481a63dfd18503d30fd67cf8765b 100644 --- a/python/paddle/reader/decorator.py +++ b/python/paddle/reader/decorator.py @@ -13,7 +13,6 @@ # limitations under the License. from threading import Thread -import subprocess import multiprocessing import six import sys @@ -26,9 +25,7 @@ from six.moves import map from six.moves import zip import itertools import random -import zlib -import paddle.compat as cpt from paddle.fluid.reader import QUEUE_GET_TIMEOUT __all__ = [] diff --git a/python/paddle/tensor/array.py b/python/paddle/tensor/array.py index 02da6926a3f5f98b8cee209d291bcf096adf8c54..527cf692525ac0553af708c4aff145d92d4a12e4 100644 --- a/python/paddle/tensor/array.py +++ b/python/paddle/tensor/array.py @@ -14,7 +14,6 @@ # Define functions about array. -import paddle from ..static import Variable from ..framework import LayerHelper, core, _non_static_mode from ..fluid.data_feeder import check_type diff --git a/python/paddle/tensor/attribute.py b/python/paddle/tensor/attribute.py index ef5a3a229765e1528cb086840626a17a9a459b51..d68eebf1364b61ca0c49d48f31e79092348a09cd 100644 --- a/python/paddle/tensor/attribute.py +++ b/python/paddle/tensor/attribute.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ..framework import core, _non_static_mode +from ..framework import core from ..framework import LayerHelper from ..fluid.data_feeder import check_variable_and_dtype from ..fluid.data_feeder import check_type diff --git a/python/paddle/tensor/creation.py b/python/paddle/tensor/creation.py index 834137c7501bd29c32172cf17ad1698954ab5ccd..675c186d47fc30c5118ef1301047d560802fc6c7 100644 --- a/python/paddle/tensor/creation.py +++ b/python/paddle/tensor/creation.py @@ -19,12 +19,11 @@ from paddle.common_ops_import import fill_constant from ..fluid.layers import utils from ..static import Variable, device_guard from ..framework import _current_expected_place, _get_paddle_place -from ..framework import dygraph_only from ..framework import core from ..framework import in_dygraph_mode, _non_static_mode from ..framework import LayerHelper from ..fluid.data_feeder import check_variable_and_dtype, check_type, check_dtype, convert_dtype -from ..framework import convert_np_dtype_to_dtype_, _varbase_creator, OpProtoHolder +from ..framework import convert_np_dtype_to_dtype_ # TODO: define functions to get create a tensor import paddle from paddle import _C_ops, _legacy_C_ops diff --git a/python/paddle/tensor/einsum.py b/python/paddle/tensor/einsum.py index a4a4b3f959b7c6886419a374de07dc1387656875..f8b014afb617af781629e33e7ae1bdbc1ae96775 100644 --- a/python/paddle/tensor/einsum.py +++ b/python/paddle/tensor/einsum.py @@ -16,15 +16,15 @@ import itertools import numpy as np import re -from .linalg import dot, matmul, transpose +from .linalg import matmul, transpose from .manipulation import squeeze, unsqueeze, reshape from .math import multiply from .math import sum as paddle_sum from ..fluid.framework import _in_legacy_dygraph from paddle import _C_ops, _legacy_C_ops -from ..fluid.data_feeder import check_variable_and_dtype, check_type, check_dtype +from ..fluid.data_feeder import check_type, check_variable_and_dtype from ..fluid.layer_helper import LayerHelper -from ..fluid.framework import _non_static_mode, in_dygraph_mode, _in_legacy_dygraph +from ..fluid.framework import _in_legacy_dygraph, in_dygraph_mode import collections import string import opt_einsum diff --git a/python/paddle/tensor/layer_function_generator.py b/python/paddle/tensor/layer_function_generator.py index 9acb4e87f333a4730e224dcfe809d9deb8b03ee3..a9a7bb6db6add36a68bea6eea2327cc941767cc9 100644 --- a/python/paddle/tensor/layer_function_generator.py +++ b/python/paddle/tensor/layer_function_generator.py @@ -13,17 +13,15 @@ # limitations under the License. import re -import functools import warnings import string from six.moves import cStringIO from ..static import Variable from ..fluid.proto import framework_pb2 -from ..framework import OpProtoHolder, core, convert_np_dtype_to_dtype_, _non_static_mode, in_dygraph_mode, _in_legacy_dygraph +from ..framework import OpProtoHolder, _non_static_mode, convert_np_dtype_to_dtype_, core, in_dygraph_mode from ..framework import LayerHelper from ..fluid.data_feeder import check_variable_and_dtype -import paddle from paddle import _C_ops, _legacy_C_ops __all__ = [] diff --git a/python/paddle/tensor/linalg.py b/python/paddle/tensor/linalg.py index d8e55c1de99217e6231a452460c9a0e2113a4ef4..9d2844f51afa9d68a194bb1c90768b76d76da1e4 100644 --- a/python/paddle/tensor/linalg.py +++ b/python/paddle/tensor/linalg.py @@ -14,7 +14,7 @@ import numpy as np from ..framework import LayerHelper -from ..framework import _varbase_creator, _dygraph_tracer, in_dygraph_mode, _non_static_mode +from ..framework import _non_static_mode, in_dygraph_mode from ..fluid.data_feeder import check_variable_and_dtype, check_type, check_dtype from ..static import Variable from ..fluid.framework import _in_legacy_dygraph @@ -24,7 +24,6 @@ from .logic import logical_not from .creation import full import paddle -import warnings from paddle.common_ops_import import VarDesc from paddle import _C_ops, _legacy_C_ops diff --git a/python/paddle/tensor/logic.py b/python/paddle/tensor/logic.py index 53649931ee6db666c35514d1caa99a948c722c61..6945ab3fd3f11d7ab5632f385544cc063d8f8334 100755 --- a/python/paddle/tensor/logic.py +++ b/python/paddle/tensor/logic.py @@ -23,7 +23,7 @@ if _in_eager_mode_: else: from ..framework import VarBase as Tensor -from ..framework import in_dygraph_mode, _non_static_mode +from ..framework import in_dygraph_mode from ..framework import LayerHelper from ..fluid.framework import _in_legacy_dygraph # TODO: define logic functions of a tensor diff --git a/python/paddle/tensor/manipulation.py b/python/paddle/tensor/manipulation.py index d5285351a29a14396c4135377072b8d0c2ab0ae7..540dd235e22549d7fd401b7c3fdf34dd77e1e12a 100644 --- a/python/paddle/tensor/manipulation.py +++ b/python/paddle/tensor/manipulation.py @@ -14,16 +14,15 @@ from collections import Counter -from ..static import Variable, device_guard +from ..static import Variable from ..framework import core, in_dygraph_mode -from ..fluid.framework import _in_legacy_dygraph, _in_eager_without_dygraph_check, _non_static_mode +from ..fluid.framework import _in_legacy_dygraph, _non_static_mode from ..framework import LayerHelper -from ..framework import OpProtoHolder, convert_np_dtype_to_dtype_, dygraph_only +from ..framework import convert_np_dtype_to_dtype_, dygraph_only from ..fluid.data_feeder import convert_dtype, check_variable_and_dtype, check_type, check_dtype from ..fluid.layers import utils import numpy as np # TODO: define functions to manipulate a tensor -from ..fluid.layers.nn import _elementwise_op_in_dygraph from ..fluid.dygraph.inplace_utils import inplace_apis_in_dygraph_only import paddle from paddle import _C_ops, _legacy_C_ops diff --git a/python/paddle/tensor/math.py b/python/paddle/tensor/math.py index 12099726028a6472478e0163abaf53eeeb153848..ffe426876ad1cae1832a379ba93259a4e36b4634 100644 --- a/python/paddle/tensor/math.py +++ b/python/paddle/tensor/math.py @@ -23,7 +23,7 @@ from paddle.common_ops_import import dygraph_utils from .manipulation import cast from .creation import _complex_to_real_dtype -from .layer_function_generator import _generate_doc_string_, generate_activation_fn, generate_layer_fn +from .layer_function_generator import generate_layer_fn import paddle from ..static import Variable diff --git a/python/paddle/tensor/ops.py b/python/paddle/tensor/ops.py index 35dee2823954cb5bca3bd9f17a1748dfce609c9a..46648f06d8205b765e32c6053d814828635b95c0 100644 --- a/python/paddle/tensor/ops.py +++ b/python/paddle/tensor/ops.py @@ -12,14 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os from .layer_function_generator import generate_layer_fn, generate_activation_fn, generate_inplace_fn, add_sample_code -from ..framework import core -from ..framework import convert_np_dtype_to_dtype_ -from ..static import Variable -from ..fluid.data_feeder import convert_dtype, check_variable_and_dtype, check_type, check_dtype from ..fluid.framework import in_dygraph_mode -from .. import _C_ops, _legacy_C_ops +from .. import _C_ops __deprecated_func_name__ = { 'tanh_shrink': 'tanhshrink', diff --git a/python/paddle/tensor/search.py b/python/paddle/tensor/search.py index 06813fbcf28f6d417b2dfb2a3c86086f00582fc0..0584ae8dcdd909411b7d79877c0e6fc0017feb80 100644 --- a/python/paddle/tensor/search.py +++ b/python/paddle/tensor/search.py @@ -14,14 +14,12 @@ import numpy as np import paddle from ..framework import LayerHelper, convert_np_dtype_to_dtype_ -from ..fluid.data_feeder import check_variable_and_dtype, check_type, check_dtype -from ..fluid import layers +from ..fluid.data_feeder import check_dtype, check_variable_and_dtype from ..framework import core, in_dygraph_mode, _non_static_mode from ..fluid.framework import _in_legacy_dygraph from paddle.common_ops_import import Variable from paddle.common_ops_import import VarDesc from paddle import _C_ops, _legacy_C_ops -from .logic import logical_not # TODO: define searching & indexing functions of a tensor # from ..fluid.layers import has_inf #DEFINE_ALIAS diff --git a/python/paddle/tensor/stat.py b/python/paddle/tensor/stat.py index 3f4e23c2baf446a68762f7ce4e12466b2c4748b8..a22a2649719af6fc75df27a8bb16575e1b30cb99 100644 --- a/python/paddle/tensor/stat.py +++ b/python/paddle/tensor/stat.py @@ -14,13 +14,12 @@ # TODO: define statistical functions of a tensor -import numpy as np from ..static import Variable from ..framework import LayerHelper from ..framework import core from paddle.fluid.framework import _in_legacy_dygraph, in_dygraph_mode from .search import where -from ..fluid.data_feeder import convert_dtype, check_variable_and_dtype, check_type, check_dtype +from ..fluid.data_feeder import check_type, check_variable_and_dtype from ..fluid.layers import utils import paddle from paddle import _C_ops, _legacy_C_ops diff --git a/python/paddle/tensor/to_string.py b/python/paddle/tensor/to_string.py index 5dcaf785929849e23308b9090fd81110fa95c721..76f5c603f0f4b41e10f6db344153f0b47b817f82 100644 --- a/python/paddle/tensor/to_string.py +++ b/python/paddle/tensor/to_string.py @@ -12,10 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle import numpy as np from ..framework import core -from paddle.fluid.data_feeder import convert_dtype, check_variable_and_dtype, check_type, check_dtype +from paddle.fluid.data_feeder import check_type, convert_dtype __all__ = [] diff --git a/python/paddle/tests/dist_hapi_mnist_dynamic.py b/python/paddle/tests/dist_hapi_mnist_dynamic.py index 681fb086fbaaaa2d509fae8b1e9470673089d280..71c63eb62b4fe2387b2ae918524da6cfdf90d2f6 100644 --- a/python/paddle/tests/dist_hapi_mnist_dynamic.py +++ b/python/paddle/tests/dist_hapi_mnist_dynamic.py @@ -15,7 +15,6 @@ import unittest import numpy as np -import contextlib import paddle import paddle.fluid as fluid diff --git a/python/paddle/tests/dist_hapi_mnist_static.py b/python/paddle/tests/dist_hapi_mnist_static.py index 8977a5309689311d200a97ee3cce6257964df787..cc3b65725013c77dd75f2febcd9244276fcbfa67 100644 --- a/python/paddle/tests/dist_hapi_mnist_static.py +++ b/python/paddle/tests/dist_hapi_mnist_static.py @@ -15,7 +15,6 @@ import unittest import numpy as np -import contextlib import paddle import paddle.fluid as fluid diff --git a/python/paddle/tests/hapi_mnist_bf16_static.py b/python/paddle/tests/hapi_mnist_bf16_static.py index 2421e48d9a2f6b983eee9f02c5b8eac4eba40787..55db397be493be4ecde78cd2ac6f1dc0b752c6a1 100644 --- a/python/paddle/tests/hapi_mnist_bf16_static.py +++ b/python/paddle/tests/hapi_mnist_bf16_static.py @@ -22,7 +22,6 @@ from paddle.vision.datasets import MNIST from paddle.vision.models import LeNet import paddle.static.amp as amp import random -from paddle import callbacks import argparse import ast diff --git a/python/paddle/tests/hubconf.py b/python/paddle/tests/hubconf.py index 8e0a5f297a381ea84161d8cbc1da41e4cb295fab..d730dcff51e244543fd08529f2eae5a5e007dca8 100644 --- a/python/paddle/tests/hubconf.py +++ b/python/paddle/tests/hubconf.py @@ -14,7 +14,6 @@ dependencies = ['paddle'] -import paddle from test_hapi_hub_model import MM as _MM diff --git a/python/paddle/tests/test_audio_functions.py b/python/paddle/tests/test_audio_functions.py index cc5c83e76dc398bb88f728a6f95ebea2219a499e..200920e73123f2f24b170b1bcb947dfb251cbd2f 100644 --- a/python/paddle/tests/test_audio_functions.py +++ b/python/paddle/tests/test_audio_functions.py @@ -15,7 +15,6 @@ import unittest import librosa import numpy as np -import os import paddle import paddle.audio diff --git a/python/paddle/tests/test_audio_logmel_feature.py b/python/paddle/tests/test_audio_logmel_feature.py index a89dc583c3d583109fff9ce905ffc044d0605016..413f4053c9c708ec7d4a9d1116382216b0e59006 100644 --- a/python/paddle/tests/test_audio_logmel_feature.py +++ b/python/paddle/tests/test_audio_logmel_feature.py @@ -15,12 +15,10 @@ import unittest import librosa import numpy as np -import os import paddle import paddle.audio import scipy -from scipy import signal import itertools from parameterized import parameterized diff --git a/python/paddle/tests/test_audio_mel_feature.py b/python/paddle/tests/test_audio_mel_feature.py index 427e9864117cd3c90c806681ad17060cad16a3a5..7ddfc9ac4872163c85641f69fb40726b47bfdefe 100644 --- a/python/paddle/tests/test_audio_mel_feature.py +++ b/python/paddle/tests/test_audio_mel_feature.py @@ -15,11 +15,9 @@ import unittest import librosa import numpy as np -import os import paddle import paddle.audio -from scipy import signal import itertools from parameterized import parameterized diff --git a/python/paddle/tests/test_callback_early_stop.py b/python/paddle/tests/test_callback_early_stop.py index 03741d98820ec99a52ec2ac72a8c3cb2ed2dbb56..79a6265420148309fd1cbdef0dee768992851be4 100644 --- a/python/paddle/tests/test_callback_early_stop.py +++ b/python/paddle/tests/test_callback_early_stop.py @@ -13,8 +13,6 @@ # limitations under the License. import unittest -import time -import random import tempfile import shutil import numpy as np @@ -23,7 +21,6 @@ import paddle from paddle import Model from paddle.static import InputSpec from paddle.vision.models import LeNet -from paddle.hapi.callbacks import config_callbacks from paddle.vision.datasets import MNIST from paddle.metric import Accuracy from paddle.nn.layer.loss import CrossEntropyLoss diff --git a/python/paddle/tests/test_callback_reduce_lr_on_plateau.py b/python/paddle/tests/test_callback_reduce_lr_on_plateau.py index e841a3f2fa57d860b510fd448433332c8487a4c6..02ac3245b7f87cd82504439b59a08df5639880b9 100644 --- a/python/paddle/tests/test_callback_reduce_lr_on_plateau.py +++ b/python/paddle/tests/test_callback_reduce_lr_on_plateau.py @@ -12,24 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys import unittest -import time -import random -import tempfile -import shutil -import numpy as np import paddle import paddle.vision.transforms as T from paddle import Model from paddle.static import InputSpec from paddle.vision.models import LeNet -from paddle.hapi.callbacks import config_callbacks from paddle.vision.datasets import MNIST from paddle.metric import Accuracy from paddle.nn.layer.loss import CrossEntropyLoss -from paddle.fluid.framework import _test_eager_guard, _in_legacy_dygraph +from paddle.fluid.framework import _test_eager_guard # Accelerate unittest diff --git a/python/paddle/tests/test_callback_visualdl.py b/python/paddle/tests/test_callback_visualdl.py index 6ea6e61f4eb77c63d589c59eeefb559494155090..0cca89fa7cd3b59c80a9778fe20b36c6b528cf18 100644 --- a/python/paddle/tests/test_callback_visualdl.py +++ b/python/paddle/tests/test_callback_visualdl.py @@ -14,22 +14,14 @@ import sys import unittest -import time -import random import tempfile import shutil -import numpy as np import paddle -from paddle import Model from paddle.static import InputSpec -from paddle.vision.models import LeNet -from paddle.hapi.callbacks import config_callbacks import paddle.vision.transforms as T from paddle.vision.datasets import MNIST -from paddle.metric import Accuracy -from paddle.nn.layer.loss import CrossEntropyLoss -from paddle.fluid.framework import _test_eager_guard, _in_legacy_dygraph +from paddle.fluid.framework import _test_eager_guard class MnistDataset(MNIST): diff --git a/python/paddle/tests/test_callbacks.py b/python/paddle/tests/test_callbacks.py index b0b23b0efa382f0995bd4a930867b3d20e23cc9f..cc43f82c5c279e9a7ca61b4709e8a5221fab3fa1 100644 --- a/python/paddle/tests/test_callbacks.py +++ b/python/paddle/tests/test_callbacks.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys import unittest import time import random @@ -20,15 +19,11 @@ import tempfile import shutil import numpy as np -import paddle from paddle import Model from paddle.static import InputSpec from paddle.vision.models import LeNet from paddle.hapi.callbacks import config_callbacks -import paddle.vision.transforms as T from paddle.vision.datasets import MNIST -from paddle.metric import Accuracy -from paddle.nn.layer.loss import CrossEntropyLoss class MnistDataset(MNIST): diff --git a/python/paddle/tests/test_dataset_uci_housing.py b/python/paddle/tests/test_dataset_uci_housing.py index beff1f71fe6c467c4f240f6ba0e367d91f2e960f..563dd62efa3b62572d59a95c3d772caf33fc099d 100644 --- a/python/paddle/tests/test_dataset_uci_housing.py +++ b/python/paddle/tests/test_dataset_uci_housing.py @@ -13,11 +13,7 @@ # limitations under the License. import unittest -import os import numpy as np -import tempfile -import shutil -import cv2 from paddle.text.datasets import UCIHousing, WMT14 diff --git a/python/paddle/tests/test_dataset_voc.py b/python/paddle/tests/test_dataset_voc.py index f52abab2ca643de8997c322c099401ec769e2496..4d67ba9c10a5415f28dcd4f88364d98838847822 100644 --- a/python/paddle/tests/test_dataset_voc.py +++ b/python/paddle/tests/test_dataset_voc.py @@ -13,7 +13,6 @@ # limitations under the License. import unittest -import os import numpy as np from paddle.vision.datasets import voc2012, VOC2012 diff --git a/python/paddle/tests/test_datasets.py b/python/paddle/tests/test_datasets.py index ae55377dfdf266241425b8ed6e7f2dea341941d3..0f6396ec051491bf3fe54a37fa3a17699cb7554f 100644 --- a/python/paddle/tests/test_datasets.py +++ b/python/paddle/tests/test_datasets.py @@ -22,7 +22,7 @@ import cv2 import paddle.vision.transforms as T from paddle.vision.datasets import DatasetFolder, ImageFolder, MNIST, FashionMNIST, Flowers from paddle.dataset.common import _check_exists_and_download -from paddle.fluid.framework import _test_eager_guard, _in_legacy_dygraph +from paddle.fluid.framework import _test_eager_guard class TestFolderDatasets(unittest.TestCase): diff --git a/python/paddle/tests/test_dlpack.py b/python/paddle/tests/test_dlpack.py index 353dc7ebfef11216bcd19c66cac8ff2d23a1c52f..256ca41ffff2d5383366902026d0dcfb030d1de2 100644 --- a/python/paddle/tests/test_dlpack.py +++ b/python/paddle/tests/test_dlpack.py @@ -18,7 +18,7 @@ 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, in_dygraph_mode +from paddle.fluid.framework import _test_eager_guard class TestDLPack(unittest.TestCase): diff --git a/python/paddle/tests/test_hapi_hub_model.py b/python/paddle/tests/test_hapi_hub_model.py index e058a6e39aaf3ae98dd7d937ad1dd937aff0dd45..6170409fbe084c30f618c25ebc413752d33711cd 100644 --- a/python/paddle/tests/test_hapi_hub_model.py +++ b/python/paddle/tests/test_hapi_hub_model.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle import paddle.nn as nn import paddle.nn.functional as F diff --git a/python/paddle/tests/test_logger.py b/python/paddle/tests/test_logger.py index 6d9aba6717dcdf2cd4c0346e8959b5ca647f2673..4566a7ff693fb614ed7c662e9266ca45c8326826 100644 --- a/python/paddle/tests/test_logger.py +++ b/python/paddle/tests/test_logger.py @@ -14,7 +14,6 @@ import unittest import os -import numpy as np import shutil import tempfile diff --git a/python/paddle/tests/test_metrics.py b/python/paddle/tests/test_metrics.py index ec9f56cff4ec9d6f55d0a775352787a61ed3c836..61b20251e048603f8a7449603247ad116588b78e 100644 --- a/python/paddle/tests/test_metrics.py +++ b/python/paddle/tests/test_metrics.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os import unittest import numpy as np diff --git a/python/paddle/tests/test_model.py b/python/paddle/tests/test_model.py index 0e4c24a27376a5c845c4a3a7464160ea92975d1d..5bb47b0ddfb32b7040d4a26a3f6e4bed93396090 100644 --- a/python/paddle/tests/test_model.py +++ b/python/paddle/tests/test_model.py @@ -22,7 +22,7 @@ import tempfile import paddle from paddle import fluid from paddle import to_tensor -from paddle.nn import Conv2D, Linear, ReLU, Sequential, Softmax +from paddle.nn import Conv2D, Linear, ReLU, Sequential from paddle import Model from paddle.static import InputSpec @@ -34,7 +34,6 @@ import paddle.vision.models as models import paddle.fluid.dygraph.jit as jit from paddle.io import DistributedBatchSampler, Dataset from paddle.hapi.model import prepare_distributed_context -from paddle.fluid.dygraph.jit import declarative from paddle.fluid.dygraph.dygraph_to_static.program_translator import ProgramTranslator diff --git a/python/paddle/tests/test_read_file.py b/python/paddle/tests/test_read_file.py index dc5c8fafcd8f62853f555a72266833fd7a5b50e8..ce387f039c7e688aa46f4d7a1b6461814cf89f82 100644 --- a/python/paddle/tests/test_read_file.py +++ b/python/paddle/tests/test_read_file.py @@ -14,7 +14,6 @@ import os import cv2 -import shutil import unittest import tempfile import numpy as np diff --git a/python/paddle/tests/test_transforms.py b/python/paddle/tests/test_transforms.py index c46ab2eaf5f57d8a2b9ba78265692d53a6faebaf..f182cbd799c189923395e1db8429564e5e5e4799 100644 --- a/python/paddle/tests/test_transforms.py +++ b/python/paddle/tests/test_transforms.py @@ -21,7 +21,7 @@ import numpy as np from PIL import Image import paddle -from paddle.vision import get_image_backend, set_image_backend, image_load +from paddle.vision import image_load, set_image_backend from paddle.vision.datasets import DatasetFolder from paddle.vision.transforms import transforms import paddle.vision.transforms.functional as F diff --git a/python/paddle/utils/cpp_extension/cpp_extension.py b/python/paddle/utils/cpp_extension/cpp_extension.py index 2a9cefa0b9e88c2e2ffd28a400385c8ecf2a5c75..4ac8949d4753ce2d4ce9d85e80c9481dc0d94352 100644 --- a/python/paddle/utils/cpp_extension/cpp_extension.py +++ b/python/paddle/utils/cpp_extension/cpp_extension.py @@ -22,11 +22,11 @@ from setuptools.command.easy_install import easy_install from setuptools.command.build_ext import build_ext from distutils.command.build import build -from .extension_utils import find_cuda_home, find_rocm_home, normalize_extension_kwargs, add_compile_flag, run_cmd +from .extension_utils import add_compile_flag, find_cuda_home, find_rocm_home, normalize_extension_kwargs from .extension_utils import is_cuda_file, prepare_unix_cudaflags, prepare_win_cudaflags from .extension_utils import _import_module_from_library, _write_setup_file, _jit_compile from .extension_utils import check_abi_compatibility, log_v, CustomOpInfo, parse_op_name_from -from .extension_utils import clean_object_if_change_cflags, _reset_so_rpath, _get_fluid_path +from .extension_utils import _reset_so_rpath, clean_object_if_change_cflags from .extension_utils import bootstrap_context, get_build_directory, add_std_without_repeat from .extension_utils import IS_WINDOWS, OS_NAME, MSVC_COMPILE_FLAGS, MSVC_COMPILE_FLAGS diff --git a/python/paddle/utils/cpp_extension/extension_utils.py b/python/paddle/utils/cpp_extension/extension_utils.py index 4d9b14fad151bbfeabd8c1e098d29848e77ce3b9..8b07abe7c8501062269c9b265b4ff047acbfafe7 100644 --- a/python/paddle/utils/cpp_extension/extension_utils.py +++ b/python/paddle/utils/cpp_extension/extension_utils.py @@ -397,7 +397,6 @@ def _get_core_name(): """ Return pybind DSO module name. """ - import paddle ext_name = '.pyd' if IS_WINDOWS else '.so' return 'libpaddle' + ext_name diff --git a/python/paddle/utils/dlpack.py b/python/paddle/utils/dlpack.py index 43c9e6b1787b2aac6afb07870c0396a7d023fedb..bc05cd9c29964c8fd0d6e70f7bd56aad28346cb1 100644 --- a/python/paddle/utils/dlpack.py +++ b/python/paddle/utils/dlpack.py @@ -15,7 +15,7 @@ import paddle from ..fluid.core import LoDTensor from ..fluid.framework import _non_static_mode -from ..fluid.data_feeder import check_type, check_dtype, convert_dtype +from ..fluid.data_feeder import check_type __all__ = [ 'to_dlpack', diff --git a/python/paddle/utils/download.py b/python/paddle/utils/download.py index be487665f1ce4b92eb9c6ec53f28b48131dc094a..270ad51c66f6d2fb4e1c206369583b4aa6b1a319 100644 --- a/python/paddle/utils/download.py +++ b/python/paddle/utils/download.py @@ -22,7 +22,6 @@ import hashlib import tarfile import zipfile import time -from collections import OrderedDict try: from tqdm import tqdm diff --git a/python/paddle/utils/install_check.py b/python/paddle/utils/install_check.py index 4d05aea21aa750209d3ea49a6a01b40c7391ae5e..f8fd9d71df58e52b985d2dc027e0ba058ac96fa5 100644 --- a/python/paddle/utils/install_check.py +++ b/python/paddle/utils/install_check.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os import logging import numpy as np