提交 25924b81 编写于 作者: G gfwm2013

Modify chinese documents of While and while_loop

test=develop
上级 868c7049
......@@ -14,8 +14,9 @@ While
如果参数 ``cond`` 的形状为[1],强烈建议您使用新的OP :ref:`cn_api_fluid_layers_while_loop` 而不是 ``While``。
OP :ref:`cn_api_fluid_layers_while_loop` 的使用方式更简单,并且调用该OP所用的代码更少且功能与 ``While`` 一样。
``While`` 类似于C++中的while,在 ``While`` 中创建的局部变量是无法通过 ``Executor`` 中的 ``fetch_list`` 来捕获的。
若想实现该功能,请参考示例代码2 或参考 `issue#22724 <https://github.com/PaddlePaddle/Paddle/issues/22724>`_ 。
**注意:**
在 ``While`` 中创建的局部变量类似于C++中的while,无法被外部引用,因此无法通过 ``Executor`` 中的 ``fetch_list`` 来获取。
若想实现该功能,PaddlePaddle提供了 ``assign`` 接口将局部变量赋值到外部,请参考示例代码2 或参考 `issue#22724 <https://github.com/PaddlePaddle/Paddle/issues/22724>`_ 。
参数:
- **cond** (Variable) – 用于判断循环继续进行的条件,为数据类型bool型的Tensor,其shape必须为[1]。
......
......@@ -10,8 +10,8 @@ ____________________________________
该API用于实现类似while的循环控制功能,只要循环条件 ``cond`` 的返回值为True,``while_loop`` 则会循环执行循环体 ``body`` ,直到 ``cond`` 的返回值为False。
**注意**:
``body`` 中定义的局部变量无法使用 ``Executor`` 的 ``fetch_list`` 来捕获的,变量需在 ``body`` 外定义并将其置于 ``loop_vars`` 中进行循环更新后才可通过 ``fetch_list`` 捕获
**注意:**
``body`` 中定义的局部变量无法使用 ``Executor`` 的 ``fetch_list`` 来获取的,变量需在 ``body`` 外定义并将其置于 ``loop_vars`` 中进行循环更新后才可通过 ``fetch_list`` 获取
参数:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册