Skip to content

Commit

Permalink
[CodeStyle][F401] remove unused imports in python_paddle/nn_tensor_re…
Browse files Browse the repository at this point in the history
…ader_tests_distributed_distribution_dataset_utils. (PaddlePaddle#46721)
  • Loading branch information
Yulv-git authored Oct 12, 2022
1 parent 35674c3 commit e4dcc90
Show file tree
Hide file tree
Showing 78 changed files with 55 additions and 217 deletions.
1 change: 0 additions & 1 deletion python/paddle/dataset/cifar.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"""

import itertools
import numpy
import paddle.dataset.common
import paddle.utils.deprecated as deprecated
Expand Down
2 changes: 0 additions & 2 deletions python/paddle/dataset/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import os
import errno
import shutil
import six
import sys
import importlib
import paddle.dataset
Expand Down Expand Up @@ -55,7 +54,6 @@ def must_mkdirs(path):
except OSError as exc:
if exc.errno != errno.EEXIST:
raise
pass


must_mkdirs(DATA_HOME)
Expand Down
1 change: 0 additions & 1 deletion python/paddle/dataset/conll05.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import tarfile
import gzip
import itertools
import paddle.dataset.common
import paddle.compat as cpt
import paddle.utils.deprecated as deprecated
Expand Down
8 changes: 0 additions & 8 deletions python/paddle/dataset/flowers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,16 @@
"""

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__ = []
Expand Down
1 change: 0 additions & 1 deletion python/paddle/dataset/movielens.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import paddle.dataset.common
import paddle.utils.deprecated as deprecated
import re
import random
import functools
import six
import paddle.compat as cpt
Expand Down
1 change: 0 additions & 1 deletion python/paddle/dataset/wmt14.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import six
import tarfile
import gzip

import paddle.dataset.common
import paddle.compat as cpt
Expand Down
1 change: 0 additions & 1 deletion python/paddle/dataset/wmt16.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import os
import six
import tarfile
import gzip
from collections import defaultdict

import paddle
Expand Down
16 changes: 4 additions & 12 deletions python/paddle/distribution/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 2 additions & 8 deletions python/paddle/distribution/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/distribution/exponential_family.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/distribution/kl.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
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"]

Expand Down
2 changes: 0 additions & 2 deletions python/paddle/distribution/multinomial.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
14 changes: 4 additions & 10 deletions python/paddle/distribution/normal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion python/paddle/distribution/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import enum
import functools
import math
import numbers
import operator
import typing

Expand Down
13 changes: 3 additions & 10 deletions python/paddle/distribution/uniform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 1 addition & 3 deletions python/paddle/nn/functional/activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@

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
Expand Down
6 changes: 1 addition & 5 deletions python/paddle/nn/functional/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,20 @@
# 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
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
Expand Down
5 changes: 0 additions & 5 deletions python/paddle/nn/functional/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,7 +30,6 @@
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__ = []

Expand Down
1 change: 0 additions & 1 deletion python/paddle/nn/functional/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
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
Expand Down
4 changes: 1 addition & 3 deletions python/paddle/nn/functional/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = []
Expand Down
1 change: 0 additions & 1 deletion python/paddle/nn/functional/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
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
Expand Down
5 changes: 1 addition & 4 deletions python/paddle/nn/functional/norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@
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__ = []

Expand Down
1 change: 0 additions & 1 deletion python/paddle/nn/functional/pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
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

Expand Down
5 changes: 1 addition & 4 deletions python/paddle/nn/functional/sparse_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 0 additions & 2 deletions python/paddle/nn/functional/vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
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
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/nn/initializer/dirac.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
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__ = []
Expand Down
3 changes: 1 addition & 2 deletions python/paddle/nn/initializer/orthogonal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = []

Expand Down
1 change: 0 additions & 1 deletion python/paddle/nn/layer/activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion python/paddle/nn/layer/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading

0 comments on commit e4dcc90

Please sign in to comment.