From e784884e70ecba4a419db785579a579ef31c2208 Mon Sep 17 00:00:00 2001 From: xjqbest <173596896@qq.com> Date: Wed, 10 Apr 2019 11:13:51 +0800 Subject: [PATCH] add Example in doc string of split_filelist test=develop --- .../fluid/incubate/fleet/parameter_server/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/python/paddle/fluid/incubate/fleet/parameter_server/__init__.py b/python/paddle/fluid/incubate/fleet/parameter_server/__init__.py index 926dd3649b2..5eefb6e94d1 100644 --- a/python/paddle/fluid/incubate/fleet/parameter_server/__init__.py +++ b/python/paddle/fluid/incubate/fleet/parameter_server/__init__.py @@ -247,6 +247,12 @@ class Fleet(object): for example, filelist is [a, b, c ,d, e] and trainer_num = 2, then trainer 0 gets [a, b, c] and trainer 1 gets [d, e] + Example: + >>> all_filelist = ["a.txt", "b.txt", "c.txt"] + >>> my_filelist = fleet.split_filelist(all_filelist) + >>> dataset = fluid.DatasetFactory().create_dataset() + >>> dataset.set_filelist(my_filelist) + Args: filelist(list): list of filename, can be local or hdfs/afs. @@ -266,8 +272,8 @@ class Fleet(object): length = file_num / trainer_num + (i < (file_num % trainer_num)) start = end end += length - myfilelist = filelist[start:end] - return myfilelist + my_filelist = filelist[start:end] + return my_filelist def _set_opt_info(self, opt_info): """ -- GitLab