From 614a2a4f9836f5e29744e050d77c9f09bec8b2a1 Mon Sep 17 00:00:00 2001 From: guofei <52460041+gfwm2013@users.noreply.github.com> Date: Fri, 14 Feb 2020 09:18:39 +0800 Subject: [PATCH] modify English document while_loop (#22573) As the title. --- python/paddle/fluid/layers/control_flow.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/python/paddle/fluid/layers/control_flow.py b/python/paddle/fluid/layers/control_flow.py index 12342ae6164..425d43e8f1e 100755 --- a/python/paddle/fluid/layers/control_flow.py +++ b/python/paddle/fluid/layers/control_flow.py @@ -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 -- GitLab