diff --git a/python/paddle/__init__.py b/python/paddle/__init__.py index 94091c94bb5330f66afee70d97bfbf763700c197..4b9f310e73bbe01c8c3d61b80558ffac304f31f3 100755 --- a/python/paddle/__init__.py +++ b/python/paddle/__init__.py @@ -265,6 +265,7 @@ from .framework import DataParallel #DEFINE_ALIAS from .framework import set_default_dtype #DEFINE_ALIAS from .framework import get_default_dtype #DEFINE_ALIAS +from .framework import set_grad_enabled #DEFINE_ALIAS from .tensor.search import index_sample #DEFINE_ALIAS from .tensor.stat import mean #DEFINE_ALIAS diff --git a/python/paddle/dataset/__init__.py b/python/paddle/dataset/__init__.py index 2db867d7a7acbf590c3e334fcabd5f43efd1474f..4b71ff6ac66f1e75f9aad0b49c6618b52c30c4a0 100644 --- a/python/paddle/dataset/__init__.py +++ b/python/paddle/dataset/__init__.py @@ -15,18 +15,18 @@ Dataset package. """ -import paddle.dataset.mnist -import paddle.dataset.imikolov -import paddle.dataset.imdb -import paddle.dataset.cifar -import paddle.dataset.movielens -import paddle.dataset.conll05 -import paddle.dataset.uci_housing -import paddle.dataset.wmt14 -import paddle.dataset.wmt16 -import paddle.dataset.flowers -import paddle.dataset.voc2012 -import paddle.dataset.image +import paddle.dataset.mnist # noqa: F401 +import paddle.dataset.imikolov # noqa: F401 +import paddle.dataset.imdb # noqa: F401 +import paddle.dataset.cifar # noqa: F401 +import paddle.dataset.movielens # noqa: F401 +import paddle.dataset.conll05 # noqa: F401 +import paddle.dataset.uci_housing # noqa: F401 +import paddle.dataset.wmt14 # noqa: F401 +import paddle.dataset.wmt16 # noqa: F401 +import paddle.dataset.flowers # noqa: F401 +import paddle.dataset.voc2012 # noqa: F401 +import paddle.dataset.image # noqa: F401 # set __all__ as empty for not showing APIs under paddle.dataset __all__ = [] diff --git a/python/paddle/dataset/cifar.py b/python/paddle/dataset/cifar.py index 2ee95c3723b3ab771f9859d0b658ae0ee8f8291a..a6b6e28c0f5a352dbfa39f186de73cc70736b835 100644 --- a/python/paddle/dataset/cifar.py +++ b/python/paddle/dataset/cifar.py @@ -37,8 +37,6 @@ import tarfile import six from six.moves import cPickle as pickle -__all__ = ['train100', 'test100', 'train10', 'test10'] - URL_PREFIX = 'https://dataset.bj.bcebos.com/cifar/' CIFAR10_URL = URL_PREFIX + 'cifar-10-python.tar.gz' CIFAR10_MD5 = 'c58f30108f718f92721af3b95e74349a' diff --git a/python/paddle/dataset/common.py b/python/paddle/dataset/common.py index 2884fa0ce5e3d037fe2e929218da0aa52c1c0d8e..cff0c6257387c21d04a019eaf6d61db5790bf476 100644 --- a/python/paddle/dataset/common.py +++ b/python/paddle/dataset/common.py @@ -26,14 +26,6 @@ import paddle.dataset import six.moves.cPickle as pickle import glob -__all__ = [ - 'DATA_HOME', - 'download', - 'md5file', - 'split', - 'cluster_files_reader', -] - HOME = os.path.expanduser('~') DATA_HOME = os.path.join(HOME, '.cache', 'paddle', 'dataset') diff --git a/python/paddle/dataset/conll05.py b/python/paddle/dataset/conll05.py index e7176626ca2d18cda5e61f267d2273b66b118adf..96fd5ae7d76c81e5a531efc7d5f99417abf2d0f4 100644 --- a/python/paddle/dataset/conll05.py +++ b/python/paddle/dataset/conll05.py @@ -30,8 +30,6 @@ import paddle.compat as cpt import paddle.utils.deprecated as deprecated from six.moves import zip, range -__all__ = ['test, get_dict', 'get_embedding'] - DATA_URL = 'http://paddlemodels.bj.bcebos.com/conll05st/conll05st-tests.tar.gz' DATA_MD5 = '387719152ae52d60422c016e92a742fc' WORDDICT_URL = 'http://paddlemodels.bj.bcebos.com/conll05st%2FwordDict.txt' diff --git a/python/paddle/dataset/flowers.py b/python/paddle/dataset/flowers.py index e16ea6e561eae3b62f1d140f78d4b60abbaa08cc..67ffd8e1ee1edaab2539591603cef3f774a42c50 100644 --- a/python/paddle/dataset/flowers.py +++ b/python/paddle/dataset/flowers.py @@ -35,7 +35,12 @@ import itertools import functools from .common import download import tarfile -from paddle.dataset.image import * + +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 @@ -45,7 +50,6 @@ from multiprocessing import cpu_count import six from six.moves import cPickle as pickle from paddle.utils import try_import -__all__ = ['train', 'test', 'valid'] DATA_URL = 'http://paddlemodels.bj.bcebos.com/flowers/102flowers.tgz' LABEL_URL = 'http://paddlemodels.bj.bcebos.com/flowers/imagelabels.mat' diff --git a/python/paddle/dataset/image.py b/python/paddle/dataset/image.py index 09b5607252bda6ffb1a410a1cb194e4a6394abe4..31329cd978cb59c8cfcf5c6038839c3b9bca904e 100644 --- a/python/paddle/dataset/image.py +++ b/python/paddle/dataset/image.py @@ -58,12 +58,6 @@ import os import tarfile import six.moves.cPickle as pickle -__all__ = [ - "load_image_bytes", "load_image", "resize_short", "to_chw", "center_crop", - "random_crop", "left_right_flip", "simple_transform", "load_and_transform", - "batch_images_from_tar" -] - def _check_cv2(): if cv2 is None: diff --git a/python/paddle/dataset/imdb.py b/python/paddle/dataset/imdb.py index dab3c964cc6b73c7149d53b6899ded2effc2e97a..33ae4405c502b3a7f8998820b038f5beb0819830 100644 --- a/python/paddle/dataset/imdb.py +++ b/python/paddle/dataset/imdb.py @@ -30,8 +30,6 @@ import re import string import six -__all__ = ['build_dict', 'train', 'test'] - #URL = 'http://ai.stanford.edu/%7Eamaas/data/sentiment/aclImdb_v1.tar.gz' URL = 'https://dataset.bj.bcebos.com/imdb%2FaclImdb_v1.tar.gz' MD5 = '7c2ac02c03563afcf9b574c7e56c153a' diff --git a/python/paddle/dataset/imikolov.py b/python/paddle/dataset/imikolov.py index cc8e95fc342c28a12070582e27134ffa1800bd5d..3b8b12303c9493716984f7c2a974315b41eb13b5 100644 --- a/python/paddle/dataset/imikolov.py +++ b/python/paddle/dataset/imikolov.py @@ -27,8 +27,6 @@ import collections import tarfile import six -__all__ = ['train', 'test', 'build_dict'] - #URL = 'http://www.fit.vutbr.cz/~imikolov/rnnlm/simple-examples.tgz' URL = 'https://dataset.bj.bcebos.com/imikolov%2Fsimple-examples.tgz' MD5 = '30177ea32e27c525793142b6bf2c8e2d' diff --git a/python/paddle/dataset/mnist.py b/python/paddle/dataset/mnist.py index 14e54d593bbe7eb351e1371d107e1144ed4df5f8..06e8174a61e803fe0fed067aad5556726837839a 100644 --- a/python/paddle/dataset/mnist.py +++ b/python/paddle/dataset/mnist.py @@ -26,7 +26,6 @@ import gzip import numpy import struct from six.moves import range -__all__ = ['train', 'test'] URL_PREFIX = 'https://dataset.bj.bcebos.com/mnist/' TEST_IMAGE_URL = URL_PREFIX + 't10k-images-idx3-ubyte.gz' diff --git a/python/paddle/dataset/movielens.py b/python/paddle/dataset/movielens.py index f753f405bba1f2671a4ac4acbcfb024bd417d6ca..23781b65785b10779de8ef56eadf5f27d74a5f19 100644 --- a/python/paddle/dataset/movielens.py +++ b/python/paddle/dataset/movielens.py @@ -34,11 +34,6 @@ import functools import six import paddle.compat as cpt -__all__ = [ - 'train', 'test', 'get_movie_title_dict', 'max_movie_id', 'max_user_id', - 'age_table', 'movie_categories', 'max_job_id', 'user_info', 'movie_info' -] - age_table = [1, 18, 25, 35, 45, 50, 56] #URL = 'http://files.grouplens.org/datasets/movielens/ml-1m.zip' diff --git a/python/paddle/dataset/uci_housing.py b/python/paddle/dataset/uci_housing.py index daed62fbefba18c34d120f1e95a706f7dcd34706..1bc2098350f5339234ec43b7a962ef118ea9df2e 100644 --- a/python/paddle/dataset/uci_housing.py +++ b/python/paddle/dataset/uci_housing.py @@ -29,8 +29,6 @@ import os import paddle.dataset.common import paddle.utils.deprecated as deprecated -__all__ = ['train', 'test'] - URL = 'http://paddlemodels.bj.bcebos.com/uci_housing/housing.data' MD5 = 'd4accdce7a25600298819f8e28e8d593' feature_names = [ diff --git a/python/paddle/dataset/voc2012.py b/python/paddle/dataset/voc2012.py index 5a0ff76aab4fe81883de1512bac4f91fcf1b7992..1575b44cd1677e3a28ad7c3d3fa36f9c95b223f3 100644 --- a/python/paddle/dataset/voc2012.py +++ b/python/paddle/dataset/voc2012.py @@ -29,8 +29,6 @@ from paddle.dataset.image import * import paddle.utils.deprecated as deprecated from PIL import Image -__all__ = ['train', 'test', 'val'] - VOC_URL = 'http://host.robots.ox.ac.uk/pascal/VOC/voc2012/\ VOCtrainval_11-May-2012.tar' diff --git a/python/paddle/dataset/wmt14.py b/python/paddle/dataset/wmt14.py index 3bd5e8d5bad46b74724f10307150fe33c86bd956..818f4b28ba143f99637a061563630a584e9a2521 100644 --- a/python/paddle/dataset/wmt14.py +++ b/python/paddle/dataset/wmt14.py @@ -30,12 +30,6 @@ import paddle.dataset.common import paddle.compat as cpt import paddle.utils.deprecated as deprecated -__all__ = [ - 'train', - 'test', - 'get_dict', -] - URL_DEV_TEST = ('http://www-lium.univ-lemans.fr/~schwenk/' 'cslm_joint_paper/data/dev+test.tgz') MD5_DEV_TEST = '7d7897317ddd8ba0ae5c5fa7248d3ff5' diff --git a/python/paddle/dataset/wmt16.py b/python/paddle/dataset/wmt16.py index 7f11bc4b1f013b57892bf14c43d4338bd41c9391..6804e7ab5fc33b0f15614e214c809c3e0cb2f54f 100644 --- a/python/paddle/dataset/wmt16.py +++ b/python/paddle/dataset/wmt16.py @@ -40,14 +40,6 @@ import paddle import paddle.compat as cpt import paddle.utils.deprecated as deprecated -__all__ = [ - "train", - "test", - "validation", - "fetch", - "get_dict", -] - DATA_URL = ("http://paddlemodels.bj.bcebos.com/wmt/wmt16.tar.gz") DATA_MD5 = "0c38be43600334966403524a40dcd81e" diff --git a/python/paddle/framework/__init__.py b/python/paddle/framework/__init__.py index b8684874085a9c44048d1473ddec956dcff3cf3e..660267c24e57eec082d96170b407943f7b69ac14 100644 --- a/python/paddle/framework/__init__.py +++ b/python/paddle/framework/__init__.py @@ -12,35 +12,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -# TODO: import framework api under this directory -__all__ = [ - 'create_parameter', 'ParamAttr', 'CPUPlace', 'CUDAPlace', 'CUDAPinnedPlace', - 'NPUPlace', 'get_default_dtype', 'set_default_dtype' -] +# TODO: import framework api under this directory -__all__ += [ - 'grad', 'set_grad_enabled', 'LayerList', 'load', 'save', 'no_grad', - 'DataParallel' -] +from . import random # noqa: F401 +from .random import seed # noqa: F401 +from .framework import get_default_dtype # noqa: F401 +from .framework import set_default_dtype # noqa: F401 +from .framework import set_grad_enabled # noqa: F401 -from . import random -from .random import seed -from .framework import get_default_dtype -from .framework import set_default_dtype -from .framework import set_grad_enabled +from ..fluid.param_attr import ParamAttr # noqa: F401 +from ..fluid.layers.tensor import create_parameter # noqa: F401 +from ..fluid.core import CPUPlace # noqa: F401 +from ..fluid.core import CUDAPlace # noqa: F401 +from ..fluid.core import CUDAPinnedPlace # noqa: F401 +from ..fluid.core import NPUPlace # noqa: F401 +from ..fluid.core import VarBase # noqa: F401 -from ..fluid.param_attr import ParamAttr #DEFINE_ALIAS -# from ..fluid.layers.tensor import create_global_var #DEFINE_ALIAS -from ..fluid.layers.tensor import create_parameter #DEFINE_ALIAS -from ..fluid.core import CPUPlace #DEFINE_ALIAS -from ..fluid.core import CUDAPlace #DEFINE_ALIAS -from ..fluid.core import CUDAPinnedPlace #DEFINE_ALIAS -from ..fluid.core import NPUPlace #DEFINE_ALIAS -from ..fluid.core import VarBase #DEFINE_ALIAS - -from paddle.fluid import core #DEFINE_ALIAS -from ..fluid.dygraph.base import no_grad_ as no_grad #DEFINE_ALIAS -from ..fluid.dygraph.base import grad #DEFINE_ALIAS -from .io import save -from .io import load -from ..fluid.dygraph.parallel import DataParallel #DEFINE_ALIAS +from paddle.fluid import core # noqa: F401 +from ..fluid.dygraph.base import no_grad_ as no_grad # noqa: F401 +from ..fluid.dygraph.base import grad # noqa: F401 +from .io import save # noqa: F401 +from .io import load # noqa: F401 +from ..fluid.dygraph.parallel import DataParallel # noqa: F401 diff --git a/python/paddle/framework/framework.py b/python/paddle/framework/framework.py index 77be85a3195fd6dbac6f07c57e867f01343dfc2a..f50285010cc5de9cd86721c224332fab983490a4 100644 --- a/python/paddle/framework/framework.py +++ b/python/paddle/framework/framework.py @@ -19,8 +19,6 @@ from paddle.fluid.framework import _dygraph_tracer import numpy as np from contextlib import contextmanager -__all__ = ['set_default_dtype', 'get_default_dtype'] - def set_default_dtype(d): """ diff --git a/python/paddle/framework/io.py b/python/paddle/framework/io.py index 32a62d2461a14b2a68ca92844afad0f6a102424a..955d8610a590968f5307005e7b5db540b57678a6 100644 --- a/python/paddle/framework/io.py +++ b/python/paddle/framework/io.py @@ -38,11 +38,6 @@ 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 -__all__ = [ - 'save', - 'load', -] - def _build_saved_state_dict(state_dict): save_dict = {} diff --git a/python/paddle/framework/random.py b/python/paddle/framework/random.py index 1624a069a51eca24926bbaa030e43671e176ca00..cce951374360b4beab73cf3e2eeff4867f77c33a 100644 --- a/python/paddle/framework/random.py +++ b/python/paddle/framework/random.py @@ -16,8 +16,6 @@ import paddle.fluid as fluid from paddle.fluid import core -__all__ = ['seed', 'get_cuda_rng_state', 'set_cuda_rng_state'] - def seed(seed): """