未验证 提交 614a2a4f 编写于 作者: G guofei 提交者: GitHub

modify English document while_loop (#22573)

As the title.
上级 e28833a8
......@@ -930,15 +930,15 @@ def while_loop(cond, body, loop_vars, is_test=False, name=None):
Args:
cond(Callable): A callable returning a boolean tensor controlling whether to continue looping.
body(Callable): A callable returning a tuple or list of tensors of the same arity (length and structure)
and types as ``loops_vars`` .
loop_vars(list|tuple): A list or tuple of tensors that is passed to both ``cond`` and ``body`` .
body(Callable): A callable returning a tuple or list of tensors and LoDTensorArrays of the same arity
(length and structure) and types as ``loops_vars`` .
loop_vars(list|tuple): A list or tuple of tensors and LoDTensorArrays that is passed to both ``cond`` and ``body`` .
is_test(bool, optional): A flag indicating whether execution is in test phase. Default value is False.
name(str, optional): Normally there is no need for users to set this property. For more information, please
refer to :ref:`api_guide_Name`. Default is None.
Returns:
A list or tuple of tensors which returned by ``body`` .
A list or tuple of tensors and LoDTensorArrays which returned by ``body`` .
Returen type:
list(Variable)|tuple(Variable).
......@@ -966,7 +966,6 @@ def while_loop(cond, body, loop_vars, is_test=False, name=None):
main_program = fluid.default_main_program()
startup_program = fluid.default_startup_program()
with fluid.program_guard(main_program, startup_program):
i = layers.fill_constant(shape=[1], dtype='int64', value=0) # loop counter
ten = layers.fill_constant(shape=[1], dtype='int64', value=10) # loop length
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册