From 87027a2eef46db7f66d7549ee4750e54a90ef8d2 Mon Sep 17 00:00:00 2001 From: dongdaxiang Date: Fri, 29 Mar 2019 16:01:42 +0800 Subject: [PATCH] fix API.spec problem and executor's docstring test=develop --- paddle/fluid/API.spec | 2 +- python/paddle/fluid/executor.py | 42 ++++++++++++++++++++------------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/paddle/fluid/API.spec b/paddle/fluid/API.spec index a128ef562bf..ba2e3007aa0 100644 --- a/paddle/fluid/API.spec +++ b/paddle/fluid/API.spec @@ -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_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.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.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')) diff --git a/python/paddle/fluid/executor.py b/python/paddle/fluid/executor.py index c9e87d9206f..fb0b45581b7 100644 --- a/python/paddle/fluid/executor.py +++ b/python/paddle/fluid/executor.py @@ -687,7 +687,10 @@ class Executor(object): fetch_info(String List): print information for each variable print_period(int): the number of mini-batches for each print - Example: + Returns: + None + + Examples: .. code-block:: python import paddle.fluid as fluid @@ -702,6 +705,7 @@ class Executor(object): exe.run(fluid.default_startup_program()) exe.infer_from_dataset(program=fluid.default_main_program(), dataset=dataset) + """ if self.place == paddle.fluid.CUDAPlace(): raise RuntimeError("infer_from_dataset is verified on CPUPlace" @@ -724,6 +728,7 @@ class Executor(object): self._default_executor.run_from_dataset(program.desc, scope, dataset.dataset, trainer._desc()) + return None def train_from_dataset(self, program=None, @@ -760,23 +765,27 @@ class Executor(object): will be printed during training fetch_info(String List): print information for each variable print_period(int): the number of mini-batches for each print + + Returns: + None - Example: + Examples: - .. code-block:: python - import paddle.fluid as fluid - place = fluid.CPUPlace() - exe = fluid.Executor(place) - x = fluid.layers.data(name="x", type="int64") - y = fluid.layers.data(name="y", type="int64") - dataset = fluid.DatasetFactory().create_dataset() - dataset.set_use_var([x, y]) - dataset.set_thread(2) - filelist = ["dataA.txt", "dataB.txt"] - dataset.set_filelist(filelist) - exe.run(fluid.default_startup_program()) - exe.train_from_dataset(program=fluid.default_main_program(), - dataset=dataset) + .. code-block:: python + + import paddle.fluid as fluid + place = fluid.CPUPlace() + exe = fluid.Executor(place) + x = fluid.layers.data(name="x", type="int64") + y = fluid.layers.data(name="y", type="int64") + dataset = fluid.DatasetFactory().create_dataset() + dataset.set_use_var([x, y]) + dataset.set_thread(2) + filelist = ["dataA.txt", "dataB.txt"] + dataset.set_filelist(filelist) + exe.run(fluid.default_startup_program()) + exe.train_from_dataset(program=fluid.default_main_program(), + dataset=dataset) """ if self.place == paddle.fluid.CUDAPlace(): @@ -799,3 +808,4 @@ class Executor(object): self._default_executor.run_from_dataset(program.desc, scope, dataset.dataset, trainer._desc()) + return None -- GitLab