提交 b8382076 编写于 作者: D dongdaxiang

add comment for dataset

test=develop
上级 6bf796df
...@@ -27,6 +27,7 @@ class DatasetFactory(object): ...@@ -27,6 +27,7 @@ class DatasetFactory(object):
Example: Example:
dataset = paddle.fluid.DatasetFactory.create_dataset("InMemoryDataset") dataset = paddle.fluid.DatasetFactory.create_dataset("InMemoryDataset")
""" """
def __init__(self): def __init__(self):
""" """
Init Init
...@@ -50,6 +51,7 @@ class DatasetBase(object): ...@@ -50,6 +51,7 @@ class DatasetBase(object):
""" """
Base dataset class Base dataset class
""" """
def __init__(self): def __init__(self):
""" """
Init Init
...@@ -180,6 +182,7 @@ class InMemoryDataset(DatasetBase): ...@@ -180,6 +182,7 @@ class InMemoryDataset(DatasetBase):
Example: Example:
dataset = paddle.fluid.DatasetFactory.create_dataset("InMemoryDataset") dataset = paddle.fluid.DatasetFactory.create_dataset("InMemoryDataset")
""" """
def __init__(self): def __init__(self):
""" """
Init Init
...@@ -192,6 +195,10 @@ class InMemoryDataset(DatasetBase): ...@@ -192,6 +195,10 @@ class InMemoryDataset(DatasetBase):
Load data into memory Load data into memory
Example: Example:
>>> import paddle.fluid as fluid
>>> dataset = fluid.DatasetFactory.create_dataset("InMemoryDataset")
>>> filelist = ["a.txt", "b.txt"]
>>> dataset.set_filelist(filelist)
>>> dataset.load_into_memory() >>> dataset.load_into_memory()
""" """
self._prepare_to_run() self._prepare_to_run()
...@@ -202,6 +209,10 @@ class InMemoryDataset(DatasetBase): ...@@ -202,6 +209,10 @@ class InMemoryDataset(DatasetBase):
Local shuffle Local shuffle
Example: Example:
>>> import paddle.fluid as fluid
>>> dataset = fluid.DatasetFactory.create_dataset("InMemoryDataset")
>>> filelist = ["a.txt", "b.txt"]
>>> dataset.set_filelist(filelist)
>>> dataset.local_shuffle() >>> dataset.local_shuffle()
""" """
self.dataset.local_shuffle() self.dataset.local_shuffle()
...@@ -212,6 +223,11 @@ class InMemoryDataset(DatasetBase): ...@@ -212,6 +223,11 @@ class InMemoryDataset(DatasetBase):
If you run distributed, you should pass fleet instead of None. If you run distributed, you should pass fleet instead of None.
Example: Example:
>>> import paddle.fluid as fluid
>>> import paddle.fluid.incubate.fleet.parameter_server as fleet
>>> dataset = fluid.DatasetFactory.create_dataset("InMemoryDataset")
>>> filelist = ["a.txt", "b.txt"]
>>> dataset.set_filelist(filelist)
>>> dataset.global_shuffle(fleet) >>> dataset.global_shuffle(fleet)
Args: Args:
...@@ -232,8 +248,10 @@ class QueueDataset(DatasetBase): ...@@ -232,8 +248,10 @@ class QueueDataset(DatasetBase):
QueueDataset, it will process data streamly. QueueDataset, it will process data streamly.
Example: Example:
dataset = paddle.fluid.DatasetFactory.create_dataset("QueueDataset") import paddle.fluid as fluid
dataset = fluid.DatasetFactory.create_dataset("QueueDataset")
""" """
def __init__(self): def __init__(self):
""" """
Init Init
...@@ -244,11 +262,17 @@ class QueueDataset(DatasetBase): ...@@ -244,11 +262,17 @@ class QueueDataset(DatasetBase):
def local_shuffle(self): def local_shuffle(self):
""" """
Local shuffle Local shuffle
QueueDataset does not support local shuffle
""" """
pass raise NotImplementedError(
"QueueDataset does not support local shuffle, "
"please use InMemoryDataset for local_shuffle")
def global_shuffle(self, fleet=None): def global_shuffle(self, fleet=None):
""" """
Global shuffle Global shuffle
""" """
pass raise NotImplementedError(
"QueueDataset does not support global shuffle, "
"please use InMemoryDataset for global_shuffle")
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册