提交 62bf672e 编写于 作者: Q qiaolongfei

update document for Switch

上级 21ecd357
...@@ -1142,16 +1142,19 @@ class Switch(object): ...@@ -1142,16 +1142,19 @@ class Switch(object):
The Semantics: The Semantics:
1. A `switch` control-flow checks cases one-by-one. 1. A `switch` control-flow checks cases one-by-one.
1. The condition of each case is a boolean value, which is a scalar.
1. It runs the first matched case, or the default case if there is one. 2. The condition of each case is a boolean value, which is a scalar.
1. Once it matches a case, it runs the corresponding branch and only that branch.
3. It runs the first matched case, or the default case if there is one.
4. Once it matches a case, it runs the corresponding branch and only that branch.
Examples: Examples:
.. code-block:: python .. code-block:: python
with control_flow.Switch() as switch: with fluid.control_flow.Switch() as switch:
with switch.case(global_step == zero_var): with switch.case(global_step == zero_var):
tensor.assign(input=one_var, output=div_res) fluid.tensor.assign(input=one_var, output=div_res)
""" """
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册