From 7a4cbb34e262777e4b624ce501092d42a4c6984c Mon Sep 17 00:00:00 2001 From: zhiboniu <31800336+zhiboniu@users.noreply.github.com> Date: Sun, 25 Apr 2021 13:50:12 +0800 Subject: [PATCH] update 2.0 public api in io&reader (#32022) --- python/paddle/io/__init__.py | 55 ++++++++++++++++++------------- python/paddle/reader/__init__.py | 12 +++++-- python/paddle/reader/decorator.py | 5 --- 3 files changed, 43 insertions(+), 29 deletions(-) diff --git a/python/paddle/io/__init__.py b/python/paddle/io/__init__.py index 59e2729941e..5781f78c6e4 100755 --- a/python/paddle/io/__init__.py +++ b/python/paddle/io/__init__.py @@ -13,26 +13,37 @@ # limitations under the License. # TODO: define all functions about input & output in this directory -__all__ = [ - 'Dataset', - 'IterableDataset', - 'TensorDataset', - 'ComposeDataset', - 'ChainDataset', - 'BatchSampler', - 'DistributedBatchSampler', - # 'Transform', - 'DataLoader', - 'get_worker_info', - 'Sampler', - 'SequenceSampler', - 'RandomSampler', - 'WeightedRandomSampler', - 'random_split', - 'Subset' -] -from ..fluid.io import DataLoader -from ..fluid.dataloader import Dataset, IterableDataset, BatchSampler, get_worker_info, \ - TensorDataset, Sampler, SequenceSampler, RandomSampler, DistributedBatchSampler, \ - ComposeDataset, ChainDataset, WeightedRandomSampler, Subset, random_split +from ..fluid.io import DataLoader # noqa: F401 +from ..fluid.dataloader import Dataset # noqa: F401 +from ..fluid.dataloader import IterableDataset # noqa: F401 +from ..fluid.dataloader import BatchSampler # noqa: F401 +from ..fluid.dataloader import get_worker_info # noqa: F401 +from ..fluid.dataloader import TensorDataset # noqa: F401 +from ..fluid.dataloader import Sampler # noqa: F401 +from ..fluid.dataloader import SequenceSampler # noqa: F401 +from ..fluid.dataloader import RandomSampler # noqa: F401 +from ..fluid.dataloader import DistributedBatchSampler # noqa: F401 +from ..fluid.dataloader import ComposeDataset # noqa: F401 +from ..fluid.dataloader import ChainDataset # noqa: F401 +from ..fluid.dataloader import WeightedRandomSampler # noqa: F401 +from ..fluid.dataloader import Subset # noqa: F401 +from ..fluid.dataloader import random_split # noqa: F401 + +__all__ = [ #noqa + 'Dataset', + 'IterableDataset', + 'TensorDataset', + 'ComposeDataset', + 'ChainDataset', + 'BatchSampler', + 'DistributedBatchSampler', + 'DataLoader', + 'get_worker_info', + 'Sampler', + 'SequenceSampler', + 'RandomSampler', + 'WeightedRandomSampler', + 'random_split', + 'Subset' +] diff --git a/python/paddle/reader/__init__.py b/python/paddle/reader/__init__.py index 1a4d4546923..9002cd0676e 100644 --- a/python/paddle/reader/__init__.py +++ b/python/paddle/reader/__init__.py @@ -63,7 +63,15 @@ An example implementation for multiple item data reader creator: """ -import paddle.reader.decorator -from paddle.reader.decorator import * +from paddle.reader.decorator import map_readers # noqa: F401 +from paddle.reader.decorator import shuffle # noqa: F401 +from paddle.reader.decorator import xmap_readers # noqa: F401 +from paddle.reader.decorator import firstn # noqa: F401 +from paddle.reader.decorator import buffered # noqa: F401 +from paddle.reader.decorator import compose # noqa: F401 +from paddle.reader.decorator import cache # noqa: F401 +from paddle.reader.decorator import ComposeNotAligned # noqa: F401 +from paddle.reader.decorator import chain # noqa: F401 +from paddle.reader.decorator import multiprocess_reader # noqa: F401 __all__ = [] diff --git a/python/paddle/reader/decorator.py b/python/paddle/reader/decorator.py index 8ee4d73ea84..4e1c3827d38 100644 --- a/python/paddle/reader/decorator.py +++ b/python/paddle/reader/decorator.py @@ -12,11 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -__all__ = [ - 'cache', 'map_readers', 'buffered', 'compose', 'chain', 'shuffle', - 'ComposeNotAligned', 'firstn', 'xmap_readers', 'multiprocess_reader' -] - from threading import Thread import subprocess import multiprocessing -- GitLab