提交 a9b8c9b2 编写于 作者: T Travis CI

Deploy to GitHub Pages: 20c4a4cb

上级 d451b098
此差异已折叠。
...@@ -769,7 +769,7 @@ to compute the length.</td> ...@@ -769,7 +769,7 @@ to compute the length.</td>
<h3>ConditionalBlock<a class="headerlink" href="#conditionalblock" title="Permalink to this headline"></a></h3> <h3>ConditionalBlock<a class="headerlink" href="#conditionalblock" title="Permalink to this headline"></a></h3>
<dl class="class"> <dl class="class">
<dt> <dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">ConditionalBlock</code><span class="sig-paren">(</span><em>inputs</em>, <em>name=None</em><span class="sig-paren">)</span></dt> <em class="property">class </em><code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">ConditionalBlock</code><span class="sig-paren">(</span><em>inputs</em>, <em>is_scalar_condition=False</em>, <em>name=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl> <dd></dd></dl>
</div> </div>
......
...@@ -10,8 +10,7 @@ The following example shows the usage of `fluid.switch`. ...@@ -10,8 +10,7 @@ The following example shows the usage of `fluid.switch`.
a = fluid.Var(10) a = fluid.Var(10)
b = fluid.Var(0) b = fluid.Var(0)
switch = fluid.switch() with switch() as switch:
with switch.block():
with switch.case(fluid.less_equal(a, 10)): with switch.case(fluid.less_equal(a, 10)):
fluid.print("Case 1") fluid.print("Case 1")
with switch.case(fluid.larger(a, 0)): with switch.case(fluid.larger(a, 0)):
......
...@@ -807,7 +807,7 @@ to compute the length.</td> ...@@ -807,7 +807,7 @@ to compute the length.</td>
<h3>ConditionalBlock<a class="headerlink" href="#conditionalblock" title="Permalink to this headline"></a></h3> <h3>ConditionalBlock<a class="headerlink" href="#conditionalblock" title="Permalink to this headline"></a></h3>
<dl class="class"> <dl class="class">
<dt> <dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">ConditionalBlock</code><span class="sig-paren">(</span><em>inputs</em>, <em>name=None</em><span class="sig-paren">)</span></dt> <em class="property">class </em><code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">ConditionalBlock</code><span class="sig-paren">(</span><em>inputs</em>, <em>is_scalar_condition=False</em>, <em>name=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl> <dd></dd></dl>
</div> </div>
......
...@@ -212,8 +212,7 @@ ...@@ -212,8 +212,7 @@
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">a</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span> <div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">a</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
<span class="n">b</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="n">b</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="n">switch</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">switch</span><span class="p">()</span> <span class="k">with</span> <span class="n">switch</span><span class="p">()</span> <span class="k">as</span> <span class="n">switch</span><span class="p">:</span>
<span class="k">with</span> <span class="n">switch</span><span class="o">.</span><span class="n">block</span><span class="p">():</span>
<span class="k">with</span> <span class="n">switch</span><span class="o">.</span><span class="n">case</span><span class="p">(</span><span class="n">fluid</span><span class="o">.</span><span class="n">less_equal</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="mi">10</span><span class="p">)):</span> <span class="k">with</span> <span class="n">switch</span><span class="o">.</span><span class="n">case</span><span class="p">(</span><span class="n">fluid</span><span class="o">.</span><span class="n">less_equal</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="mi">10</span><span class="p">)):</span>
<span class="n">fluid</span><span class="o">.</span><span class="k">print</span><span class="p">(</span><span class="s2">&quot;Case 1&quot;</span><span class="p">)</span> <span class="n">fluid</span><span class="o">.</span><span class="k">print</span><span class="p">(</span><span class="s2">&quot;Case 1&quot;</span><span class="p">)</span>
<span class="k">with</span> <span class="n">switch</span><span class="o">.</span><span class="n">case</span><span class="p">(</span><span class="n">fluid</span><span class="o">.</span><span class="n">larger</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="mi">0</span><span class="p">)):</span> <span class="k">with</span> <span class="n">switch</span><span class="o">.</span><span class="n">case</span><span class="p">(</span><span class="n">fluid</span><span class="o">.</span><span class="n">larger</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="mi">0</span><span class="p">)):</span>
......
...@@ -4288,6 +4288,11 @@ ...@@ -4288,6 +4288,11 @@
"type" : "block id", "type" : "block id",
"comment" : "The step block of conditional block operator", "comment" : "The step block of conditional block operator",
"generated" : 0 "generated" : 0
}, {
"name" : "is_scalar_condition",
"type" : "bool",
"comment" : "the input X is used as scalar condition",
"generated" : 0
} ] } ]
},{ },{
"type" : "rmsprop", "type" : "rmsprop",
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -10,8 +10,7 @@ The following example shows the usage of `fluid.switch`. ...@@ -10,8 +10,7 @@ The following example shows the usage of `fluid.switch`.
a = fluid.Var(10) a = fluid.Var(10)
b = fluid.Var(0) b = fluid.Var(0)
switch = fluid.switch() with switch() as switch:
with switch.block():
with switch.case(fluid.less_equal(a, 10)): with switch.case(fluid.less_equal(a, 10)):
fluid.print("Case 1") fluid.print("Case 1")
with switch.case(fluid.larger(a, 0)): with switch.case(fluid.larger(a, 0)):
......
...@@ -826,7 +826,7 @@ to compute the length.</td> ...@@ -826,7 +826,7 @@ to compute the length.</td>
<h3>ConditionalBlock<a class="headerlink" href="#conditionalblock" title="永久链接至标题"></a></h3> <h3>ConditionalBlock<a class="headerlink" href="#conditionalblock" title="永久链接至标题"></a></h3>
<dl class="class"> <dl class="class">
<dt> <dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">ConditionalBlock</code><span class="sig-paren">(</span><em>inputs</em>, <em>name=None</em><span class="sig-paren">)</span></dt> <em class="property">class </em><code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">ConditionalBlock</code><span class="sig-paren">(</span><em>inputs</em>, <em>is_scalar_condition=False</em>, <em>name=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl> <dd></dd></dl>
</div> </div>
......
...@@ -231,8 +231,7 @@ ...@@ -231,8 +231,7 @@
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">a</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span> <div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">a</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
<span class="n">b</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="n">b</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="n">switch</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">switch</span><span class="p">()</span> <span class="k">with</span> <span class="n">switch</span><span class="p">()</span> <span class="k">as</span> <span class="n">switch</span><span class="p">:</span>
<span class="k">with</span> <span class="n">switch</span><span class="o">.</span><span class="n">block</span><span class="p">():</span>
<span class="k">with</span> <span class="n">switch</span><span class="o">.</span><span class="n">case</span><span class="p">(</span><span class="n">fluid</span><span class="o">.</span><span class="n">less_equal</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="mi">10</span><span class="p">)):</span> <span class="k">with</span> <span class="n">switch</span><span class="o">.</span><span class="n">case</span><span class="p">(</span><span class="n">fluid</span><span class="o">.</span><span class="n">less_equal</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="mi">10</span><span class="p">)):</span>
<span class="n">fluid</span><span class="o">.</span><span class="k">print</span><span class="p">(</span><span class="s2">&quot;Case 1&quot;</span><span class="p">)</span> <span class="n">fluid</span><span class="o">.</span><span class="k">print</span><span class="p">(</span><span class="s2">&quot;Case 1&quot;</span><span class="p">)</span>
<span class="k">with</span> <span class="n">switch</span><span class="o">.</span><span class="n">case</span><span class="p">(</span><span class="n">fluid</span><span class="o">.</span><span class="n">larger</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="mi">0</span><span class="p">)):</span> <span class="k">with</span> <span class="n">switch</span><span class="o">.</span><span class="n">case</span><span class="p">(</span><span class="n">fluid</span><span class="o">.</span><span class="n">larger</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="mi">0</span><span class="p">)):</span>
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册