diff --git a/python/paddle/autograd/backward_mode.py b/python/paddle/autograd/backward_mode.py index 549f859b9cc390fcb1e7b6169187b70c098a8a5b..83c84a01afb2784dd5d095042a88804ea695d8f0 100644 --- a/python/paddle/autograd/backward_mode.py +++ b/python/paddle/autograd/backward_mode.py @@ -14,7 +14,7 @@ from paddle.fluid import core from paddle.fluid import framework -from paddle.fluid.backward import gradients_with_optimizer +from paddle.fluid.backward import gradients_with_optimizer # noqa: F401 import paddle __all__ = [] diff --git a/python/paddle/framework/framework.py b/python/paddle/framework/framework.py index 62cbeea8d42ccbff24c1fb2f8aa163d404dd16c6..5f59da03854205affd9a382bc1e6efee47586257 100644 --- a/python/paddle/framework/framework.py +++ b/python/paddle/framework/framework.py @@ -14,7 +14,6 @@ # TODO: define framework api from paddle.fluid.layer_helper_base import LayerHelperBase -from paddle.fluid.data_feeder import convert_dtype from paddle.fluid.framework import _dygraph_tracer import numpy as np from contextlib import contextmanager diff --git a/python/paddle/framework/io.py b/python/paddle/framework/io.py index fcf9ced7e396fda7bdb42ed09395bea3df0b609b..77e1fb47f882de374ef332d369cd07b4ce667216 100644 --- a/python/paddle/framework/io.py +++ b/python/paddle/framework/io.py @@ -31,7 +31,7 @@ from paddle.fluid.io import _open_file_buffer, _is_file_path, _is_memory_buffer from paddle.fluid.framework import Variable, _varbase_creator, _dygraph_tracer, _non_static_mode, ParamBase, EagerParamBase, _current_expected_place, Program from paddle.fluid.dygraph.jit import _SaveLoadConfig from paddle.fluid.dygraph.io import _construct_program_holders, _construct_params_and_buffers -from paddle.fluid.dygraph.io import INFER_MODEL_SUFFIX, INFER_PARAMS_SUFFIX, INFER_PARAMS_INFO_SUFFIX +from paddle.fluid.dygraph.io import INFER_MODEL_SUFFIX, INFER_PARAMS_SUFFIX try: from collections.abc import Iterable except: diff --git a/python/paddle/hapi/hub.py b/python/paddle/hapi/hub.py index 42e6b7c30826a77afb30a6ebbba052bf9a7fb60c..ccf03aa2db097defa0ec6328a990842b3b677aa0 100644 --- a/python/paddle/hapi/hub.py +++ b/python/paddle/hapi/hub.py @@ -13,7 +13,6 @@ # limitations under the License. import os -import re import sys import shutil import zipfile diff --git a/python/paddle/hapi/model.py b/python/paddle/hapi/model.py index e00bb64d9e451fabce0105299e00174dab35f315..223d71bb46d6a194681b147672ee5dead1681f4d 100644 --- a/python/paddle/hapi/model.py +++ b/python/paddle/hapi/model.py @@ -25,7 +25,7 @@ import contextlib import paddle from paddle import fluid from paddle.fluid import core -from paddle.fluid.framework import _non_static_mode, in_dygraph_mode +from paddle.fluid.framework import _non_static_mode from paddle.fluid.framework import Variable from paddle.fluid.framework import _get_paddle_place from paddle.fluid.framework import _current_expected_place as _get_device diff --git a/python/paddle/hapi/static_flops.py b/python/paddle/hapi/static_flops.py index 78630c1c2e0e3cfeba4cf1b3be9c1e38ca1dc340..8926bcb35529d9788df0039ba6ef02abd2317f0e 100644 --- a/python/paddle/hapi/static_flops.py +++ b/python/paddle/hapi/static_flops.py @@ -12,11 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import copy import numpy as np -import paddle from collections import OrderedDict -from paddle.static import Program, program_guard, Variable +from paddle.static import Program, Variable __all__ = [] diff --git a/python/paddle/optimizer/adadelta.py b/python/paddle/optimizer/adadelta.py index 6551f19487119df867ed80f0232ffe90e8ba3210..203ad8f617c3dfd193dbbdfa7e95baa67e528e97 100644 --- a/python/paddle/optimizer/adadelta.py +++ b/python/paddle/optimizer/adadelta.py @@ -13,11 +13,9 @@ # limitations under the License. from .optimizer import Optimizer -from ..fluid import core from ..fluid import framework -from ..fluid.framework import Variable, name_scope from ..framework import in_dygraph_mode -from paddle import _C_ops, _legacy_C_ops +from paddle import _C_ops from ..fluid.dygraph import no_grad __all__ = [] diff --git a/python/paddle/optimizer/adagrad.py b/python/paddle/optimizer/adagrad.py index 180af110ac44edd7c8cae30418dbc8743846027d..e0296a1cb0a6c9422644b4f650b366dd2f54b721 100644 --- a/python/paddle/optimizer/adagrad.py +++ b/python/paddle/optimizer/adagrad.py @@ -13,9 +13,7 @@ # limitations under the License. from .optimizer import Optimizer -from ..fluid import core from ..fluid import framework -from ..fluid.framework import Variable __all__ = [] diff --git a/python/paddle/optimizer/adam.py b/python/paddle/optimizer/adam.py index 41d22e778fc3ff7c8d125adae24a7c97a19b53df..a49af1a458988ebc50c9166ce0e7d9204475f35e 100644 --- a/python/paddle/optimizer/adam.py +++ b/python/paddle/optimizer/adam.py @@ -15,15 +15,13 @@ from .optimizer import Optimizer from ..fluid import core from ..fluid import framework -from ..fluid.framework import Variable, _in_legacy_dygraph, in_dygraph_mode +from ..fluid.framework import Variable, in_dygraph_mode from ..fluid import layers from ..fluid import unique_name from ..fluid.layer_helper import LayerHelper import warnings from ..fluid.dygraph import base as imperative_base from collections import defaultdict -import numpy as np -import time import paddle from paddle import _C_ops, _legacy_C_ops diff --git a/python/paddle/optimizer/adamax.py b/python/paddle/optimizer/adamax.py index 86b4ed97d1c1a60d94fae78c24cbb413c2c47e51..81ae8531f0e13239e972586af390d4541fd221c6 100644 --- a/python/paddle/optimizer/adamax.py +++ b/python/paddle/optimizer/adamax.py @@ -13,9 +13,8 @@ # limitations under the License. from .optimizer import Optimizer -from ..fluid import core from ..fluid import framework -from ..fluid.framework import Variable, name_scope +from ..fluid.framework import name_scope from paddle import _C_ops, _legacy_C_ops from ..fluid.dygraph import no_grad diff --git a/python/paddle/optimizer/lamb.py b/python/paddle/optimizer/lamb.py index 60b59e7b2c5274ddd113b6a9253df06bffaad478..6a683c6ef91716540b64b0817b2616409711a3e1 100644 --- a/python/paddle/optimizer/lamb.py +++ b/python/paddle/optimizer/lamb.py @@ -21,7 +21,6 @@ from ..fluid import unique_name from ..fluid.layer_helper import LayerHelper from paddle import _C_ops, _legacy_C_ops from paddle.fluid.executor import global_scope -import paddle __all__ = [] diff --git a/python/paddle/optimizer/momentum.py b/python/paddle/optimizer/momentum.py index f2cc8921215714f67cf5dffb8ef2d7c541adda98..5ec696f691ce475084c5521c0f5d08133eb0b1bb 100644 --- a/python/paddle/optimizer/momentum.py +++ b/python/paddle/optimizer/momentum.py @@ -17,11 +17,9 @@ import warnings from .optimizer import Optimizer from ..fluid import core from ..fluid import framework -from ..fluid.framework import Variable, name_scope from ..fluid.layer_helper import LayerHelper from ..fluid import unique_name from ..fluid import layers -import paddle.fluid as fluid from paddle.fluid.regularizer import L2DecayRegularizer from paddle import _C_ops, _legacy_C_ops import paddle diff --git a/python/paddle/optimizer/optimizer.py b/python/paddle/optimizer/optimizer.py index 0af3b14dab3b71bd2b59154a2fc81d925a3fad44..36847032d18a095c21388a5cacd1fac34d89c555 100644 --- a/python/paddle/optimizer/optimizer.py +++ b/python/paddle/optimizer/optimizer.py @@ -13,32 +13,23 @@ # limitations under the License. import numpy as np -import six import logging from collections import defaultdict import paddle -from paddle.fluid.distribute_lookup_table import find_distributed_lookup_table -from paddle.fluid.framework import Program, Variable, name_scope, default_main_program, default_startup_program, device_guard +from paddle.fluid.framework import Variable, default_main_program, device_guard, name_scope from ..fluid import framework from ..fluid import layers from ..fluid import unique_name -from ..fluid.backward import append_backward, _some_in_set_, _append_grad_suffix_, _get_no_grad_set_name -from ..fluid.clip import GradientClipBase, GradientClipByNorm, error_clip_callback, append_gradient_clip_ops +from ..fluid.backward import _get_no_grad_set_name, append_backward +from ..fluid.clip import GradientClipBase, append_gradient_clip_ops, error_clip_callback from ..fluid.framework import program_guard, Parameter from ..fluid.initializer import Constant from ..fluid.layer_helper import LayerHelper -from ..fluid.layers import ops from ..fluid.dygraph import base as imperative_base -from ..fluid.dygraph import no_grad from paddle.fluid import core -from paddle.fluid.layers import tensor -from functools import reduce -from ..fluid.wrapped_decorator import signature_safe_contextmanager -from .. import compat as cpt from .lr import LRScheduler -import copy from paddle import _C_ops, _legacy_C_ops from paddle.fluid.framework import _in_legacy_dygraph, _in_eager_without_dygraph_check, _current_expected_place, in_dygraph_mode diff --git a/python/paddle/optimizer/rmsprop.py b/python/paddle/optimizer/rmsprop.py index 0b8d7f86fa6f0674149b66aaa0bd54fee5250379..5ae5e1468beedd6a834db93c38cd5b80af142c59 100644 --- a/python/paddle/optimizer/rmsprop.py +++ b/python/paddle/optimizer/rmsprop.py @@ -13,9 +13,7 @@ # limitations under the License. from .optimizer import Optimizer -from ..fluid import core from ..fluid import framework -from ..fluid.framework import Variable __all__ = [] diff --git a/python/paddle/optimizer/sgd.py b/python/paddle/optimizer/sgd.py index 5d601422e44da71ce228730e8a1495f5413042f3..40db1d361eba5d4354674c6a47e28a89fbf610a4 100644 --- a/python/paddle/optimizer/sgd.py +++ b/python/paddle/optimizer/sgd.py @@ -15,7 +15,6 @@ from .optimizer import Optimizer from ..fluid import core from ..fluid import framework -from ..fluid.framework import Variable, name_scope from ..fluid.dygraph import no_grad from paddle import _C_ops, _legacy_C_ops import warnings