未验证 提交 a69baf63 编写于 作者: H huzhiqiang 提交者: GitHub

modify compose en (#20217)

* modify compose en

* test=develop

* test=develop

* test=develop

* test=develop

* test=develop

* test=develop

* test=develop

* test=develop

* test=develop

* test=develop,test=document_fix

* test=develop,test=document_fix
上级 6a8e5404
...@@ -96,7 +96,7 @@ paddle.fluid.io.DataLoader.from_generator (ArgSpec(args=['feed_list', 'capacity' ...@@ -96,7 +96,7 @@ paddle.fluid.io.DataLoader.from_generator (ArgSpec(args=['feed_list', 'capacity'
paddle.fluid.io.cache (ArgSpec(args=['reader'], varargs=None, keywords=None, defaults=None), ('document', '1676886070eb607cb608f7ba47be0d3c')) paddle.fluid.io.cache (ArgSpec(args=['reader'], varargs=None, keywords=None, defaults=None), ('document', '1676886070eb607cb608f7ba47be0d3c'))
paddle.fluid.io.map_readers (ArgSpec(args=['func'], varargs='readers', keywords=None, defaults=None), ('document', '2d0903e1d2f00b4f1d6618e6b5310121')) paddle.fluid.io.map_readers (ArgSpec(args=['func'], varargs='readers', keywords=None, defaults=None), ('document', '2d0903e1d2f00b4f1d6618e6b5310121'))
paddle.fluid.io.buffered (ArgSpec(args=['reader', 'size'], varargs=None, keywords=None, defaults=None), ('document', '0d6186f109feceb99f60ec50a0a624cb')) paddle.fluid.io.buffered (ArgSpec(args=['reader', 'size'], varargs=None, keywords=None, defaults=None), ('document', '0d6186f109feceb99f60ec50a0a624cb'))
paddle.fluid.io.compose (ArgSpec(args=[], varargs='readers', keywords='kwargs', defaults=None), ('document', '884291104e1c3f37f33aae44b7deeb0d')) paddle.fluid.io.compose (ArgSpec(args=[], varargs='readers', keywords='kwargs', defaults=None), ('document', '81c933c8da58041d91f084dcf6322349'))
paddle.fluid.io.chain (ArgSpec(args=[], varargs='readers', keywords=None, defaults=None), ('document', 'e0311508658a7e741fc39feea8be0ad2')) paddle.fluid.io.chain (ArgSpec(args=[], varargs='readers', keywords=None, defaults=None), ('document', 'e0311508658a7e741fc39feea8be0ad2'))
paddle.fluid.io.shuffle (ArgSpec(args=['reader', 'buf_size'], varargs=None, keywords=None, defaults=None), ('document', 'e42ea6fee23ce26b23cb142cd1d6522d')) paddle.fluid.io.shuffle (ArgSpec(args=['reader', 'buf_size'], varargs=None, keywords=None, defaults=None), ('document', 'e42ea6fee23ce26b23cb142cd1d6522d'))
paddle.fluid.io.firstn (ArgSpec(args=['reader', 'n'], varargs=None, keywords=None, defaults=None), ('document', 'c5bb8f7dd4f917f1569a368aab5b8aad')) paddle.fluid.io.firstn (ArgSpec(args=['reader', 'n'], varargs=None, keywords=None, defaults=None), ('document', 'c5bb8f7dd4f917f1569a368aab5b8aad'))
......
...@@ -207,16 +207,29 @@ def compose(*readers, **kwargs): ...@@ -207,16 +207,29 @@ def compose(*readers, **kwargs):
The composed reader will output: The composed reader will output:
(1, 2, 3, 4, 5) (1, 2, 3, 4, 5)
:param readers: readers that will be composed together. Args:
:param check_alignment: if True, will check if input readers are aligned readers (Reader|list of Reader): readers that will be composed together.
correctly. If False, will not check alignment and trailing outputs check_alignment(bool, optional): Indicates whether the input readers are checked for
will be discarded. Defaults to True. alignment. If True, whether input readers are aligned
:type check_alignment: bool correctly will be checked, else alignment will not be checkout and trailing outputs
will be discarded. Defaults to True.
:return: the new data reader.
Returns:
the new data reader (Reader).
Raises:
ComposeNotAligned: outputs of readers are not aligned. This will not raise if check_alignment is set to False.
Examples:
.. code-block:: python
:raises ComposeNotAligned: outputs of readers are not aligned. import paddle.fluid as fluid
Will not raise when check_alignment is set to False. def reader_creator_10(dur):
def reader():
for i in range(10):
yield i
return reader
reader = fluid.io.compose(reader_creator_10(0), reader_creator_10(0))
""" """
check_alignment = kwargs.pop('check_alignment', True) check_alignment = kwargs.pop('check_alignment', True)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册