提交 e784884e 编写于 作者: X xjqbest

add Example in doc string of split_filelist

test=develop
上级 1c0ef929
...@@ -247,6 +247,12 @@ class Fleet(object): ...@@ -247,6 +247,12 @@ class Fleet(object):
for example, filelist is [a, b, c ,d, e] and trainer_num = 2, 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] 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: Args:
filelist(list): list of filename, can be local or hdfs/afs. filelist(list): list of filename, can be local or hdfs/afs.
...@@ -266,8 +272,8 @@ class Fleet(object): ...@@ -266,8 +272,8 @@ class Fleet(object):
length = file_num / trainer_num + (i < (file_num % trainer_num)) length = file_num / trainer_num + (i < (file_num % trainer_num))
start = end start = end
end += length end += length
myfilelist = filelist[start:end] my_filelist = filelist[start:end]
return myfilelist return my_filelist
def _set_opt_info(self, opt_info): def _set_opt_info(self, opt_info):
""" """
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册