未验证 提交 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): ...@@ -930,15 +930,15 @@ def while_loop(cond, body, loop_vars, is_test=False, name=None):
Args: Args:
cond(Callable): A callable returning a boolean tensor controlling whether to continue looping. 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) body(Callable): A callable returning a tuple or list of tensors and LoDTensorArrays of the same arity
and types as ``loops_vars`` . (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`` . 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. 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 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. refer to :ref:`api_guide_Name`. Default is None.
Returns: 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: Returen type:
list(Variable)|tuple(Variable). list(Variable)|tuple(Variable).
...@@ -966,7 +966,6 @@ def while_loop(cond, body, loop_vars, is_test=False, name=None): ...@@ -966,7 +966,6 @@ def while_loop(cond, body, loop_vars, is_test=False, name=None):
main_program = fluid.default_main_program() main_program = fluid.default_main_program()
startup_program = fluid.default_startup_program() startup_program = fluid.default_startup_program()
with fluid.program_guard(main_program, startup_program): with fluid.program_guard(main_program, startup_program):
i = layers.fill_constant(shape=[1], dtype='int64', value=0) # loop counter i = layers.fill_constant(shape=[1], dtype='int64', value=0) # loop counter
ten = layers.fill_constant(shape=[1], dtype='int64', value=10) # loop length 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.
先完成此消息的编辑!
想要评论请 注册