提交 87027a2e 编写于 作者: D dongdaxiang

fix API.spec problem and executor's docstring

test=develop
上级 ade93374
...@@ -38,7 +38,7 @@ paddle.fluid.DataFeedDesc.desc (ArgSpec(args=['self'], varargs=None, keywords=No ...@@ -38,7 +38,7 @@ paddle.fluid.DataFeedDesc.desc (ArgSpec(args=['self'], varargs=None, keywords=No
paddle.fluid.DataFeedDesc.set_batch_size (ArgSpec(args=['self', 'batch_size'], varargs=None, keywords=None, defaults=None), ('document', '8d9f44601e0a99dd431f14fd9250cd21')) paddle.fluid.DataFeedDesc.set_batch_size (ArgSpec(args=['self', 'batch_size'], varargs=None, keywords=None, defaults=None), ('document', '8d9f44601e0a99dd431f14fd9250cd21'))
paddle.fluid.DataFeedDesc.set_dense_slots (ArgSpec(args=['self', 'dense_slots_name'], varargs=None, keywords=None, defaults=None), ('document', 'eb894b464bbcd1b4bc8038398954f766')) paddle.fluid.DataFeedDesc.set_dense_slots (ArgSpec(args=['self', 'dense_slots_name'], varargs=None, keywords=None, defaults=None), ('document', 'eb894b464bbcd1b4bc8038398954f766'))
paddle.fluid.DataFeedDesc.set_use_slots (ArgSpec(args=['self', 'use_slots_name'], varargs=None, keywords=None, defaults=None), ('document', '415c56600ce4e198c071cad01409a690')) paddle.fluid.DataFeedDesc.set_use_slots (ArgSpec(args=['self', 'use_slots_name'], varargs=None, keywords=None, defaults=None), ('document', '415c56600ce4e198c071cad01409a690'))
paddle.fluid.AsyncExecutor.__init__ (ArgSpec(args=['self', 'place', 'run_mode'], varargs=None, keywords=None, defaults=(None, '')), ('document', '06f6f5f72ad386237f1f4e81eff7b7e9')) paddle.fluid.AsyncExecutor.__init__ (ArgSpec(args=['self', 'place', 'run_mode'], varargs=None, keywords=None, defaults=(None, '')), ('document', '4e85874dddcd06c38f5717992d741589'))
paddle.fluid.AsyncExecutor.config_distributed_nodes (ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None), ('document', '762980fe0181eb41e3d1081b26ed76b1')) paddle.fluid.AsyncExecutor.config_distributed_nodes (ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None), ('document', '762980fe0181eb41e3d1081b26ed76b1'))
paddle.fluid.AsyncExecutor.download_data (ArgSpec(args=['self', 'afs_path', 'local_path', 'fs_default_name', 'ugi', 'file_cnt', 'hadoop_home', 'process_num'], varargs=None, keywords=None, defaults=('$HADOOP_HOME', 12)), ('document', '39e3ccddf8ea8db75ea85287c9147c3b')) paddle.fluid.AsyncExecutor.download_data (ArgSpec(args=['self', 'afs_path', 'local_path', 'fs_default_name', 'ugi', 'file_cnt', 'hadoop_home', 'process_num'], varargs=None, keywords=None, defaults=('$HADOOP_HOME', 12)), ('document', '39e3ccddf8ea8db75ea85287c9147c3b'))
paddle.fluid.AsyncExecutor.get_instance (ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None), ('document', 'f8688f76a2db1243c7097a60c507b182')) paddle.fluid.AsyncExecutor.get_instance (ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None), ('document', 'f8688f76a2db1243c7097a60c507b182'))
......
...@@ -687,7 +687,10 @@ class Executor(object): ...@@ -687,7 +687,10 @@ class Executor(object):
fetch_info(String List): print information for each variable fetch_info(String List): print information for each variable
print_period(int): the number of mini-batches for each print print_period(int): the number of mini-batches for each print
Example: Returns:
None
Examples:
.. code-block:: python .. code-block:: python
import paddle.fluid as fluid import paddle.fluid as fluid
...@@ -702,6 +705,7 @@ class Executor(object): ...@@ -702,6 +705,7 @@ class Executor(object):
exe.run(fluid.default_startup_program()) exe.run(fluid.default_startup_program())
exe.infer_from_dataset(program=fluid.default_main_program(), exe.infer_from_dataset(program=fluid.default_main_program(),
dataset=dataset) dataset=dataset)
""" """
if self.place == paddle.fluid.CUDAPlace(): if self.place == paddle.fluid.CUDAPlace():
raise RuntimeError("infer_from_dataset is verified on CPUPlace" raise RuntimeError("infer_from_dataset is verified on CPUPlace"
...@@ -724,6 +728,7 @@ class Executor(object): ...@@ -724,6 +728,7 @@ class Executor(object):
self._default_executor.run_from_dataset(program.desc, scope, self._default_executor.run_from_dataset(program.desc, scope,
dataset.dataset, dataset.dataset,
trainer._desc()) trainer._desc())
return None
def train_from_dataset(self, def train_from_dataset(self,
program=None, program=None,
...@@ -760,23 +765,27 @@ class Executor(object): ...@@ -760,23 +765,27 @@ class Executor(object):
will be printed during training will be printed during training
fetch_info(String List): print information for each variable fetch_info(String List): print information for each variable
print_period(int): the number of mini-batches for each print print_period(int): the number of mini-batches for each print
Returns:
None
Example: Examples:
.. code-block:: python .. code-block:: python
import paddle.fluid as fluid
place = fluid.CPUPlace() import paddle.fluid as fluid
exe = fluid.Executor(place) place = fluid.CPUPlace()
x = fluid.layers.data(name="x", type="int64") exe = fluid.Executor(place)
y = fluid.layers.data(name="y", type="int64") x = fluid.layers.data(name="x", type="int64")
dataset = fluid.DatasetFactory().create_dataset() y = fluid.layers.data(name="y", type="int64")
dataset.set_use_var([x, y]) dataset = fluid.DatasetFactory().create_dataset()
dataset.set_thread(2) dataset.set_use_var([x, y])
filelist = ["dataA.txt", "dataB.txt"] dataset.set_thread(2)
dataset.set_filelist(filelist) filelist = ["dataA.txt", "dataB.txt"]
exe.run(fluid.default_startup_program()) dataset.set_filelist(filelist)
exe.train_from_dataset(program=fluid.default_main_program(), exe.run(fluid.default_startup_program())
dataset=dataset) exe.train_from_dataset(program=fluid.default_main_program(),
dataset=dataset)
""" """
if self.place == paddle.fluid.CUDAPlace(): if self.place == paddle.fluid.CUDAPlace():
...@@ -799,3 +808,4 @@ class Executor(object): ...@@ -799,3 +808,4 @@ class Executor(object):
self._default_executor.run_from_dataset(program.desc, scope, self._default_executor.run_from_dataset(program.desc, scope,
dataset.dataset, dataset.dataset,
trainer._desc()) trainer._desc())
return None
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册