提交 8ec680e8 编写于 作者: T Travis CI

Deploy to GitHub Pages: e7acf32c

上级 5f9d733d
......@@ -358,6 +358,12 @@ reduce_min
.. autofunction:: paddle.v2.fluid.layers.reduce_min
:noindex:
split
-----
.. autofunction:: paddle.v2.fluid.layers.split
:noindex:
logsigmoid
----------
.. autofunction:: paddle.v2.fluid.layers.logsigmoid
......
......@@ -20,3 +20,8 @@ sequence_conv_pool
:noindex:
glu
---
.. autofunction:: paddle.v2.fluid.nets.glu
:noindex:
......@@ -2434,6 +2434,52 @@ than the <code class="xref py py-attr docutils literal"><span class="pre">input<
</div>
</dd></dl>
</div>
<div class="section" id="split">
<h2>split<a class="headerlink" href="#split" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">split</code><span class="sig-paren">(</span><em>input</em>, <em>num_or_sections</em>, <em>dim=-1</em><span class="sig-paren">)</span></dt>
<dd><p>Splits the tensor into multiple sub-tensors.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>input</strong> (<em>Variable</em>) &#8211; The input variable which is a Tensor or LoDTensor.</li>
<li><strong>num_or_sections</strong> (<em>int|list</em>) &#8211; If <code class="xref py py-attr docutils literal"><span class="pre">num_or_sections</span></code> is an integer,
then the integer indicates the number of equal sized sub-tensors
that the tensor will be divided into. If <code class="xref py py-attr docutils literal"><span class="pre">num_or_sections</span></code>
is a list of integers, the length of list indicates the number of
sub-tensors and the integers indicate the sizes of sub-tensors&#8217;
<code class="xref py py-attr docutils literal"><span class="pre">dim</span></code> dimension orderly.</li>
<li><strong>dim</strong> (<em>int</em>) &#8211; The dimension along which to split. If <span class="math">\(dim &lt; 0\)</span>, the
dimension to split along is <span class="math">\(rank(input) + dim\)</span>.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The list of segmented tensor variables.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">List</p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="c1"># x is a Tensor variable with shape [3, 9, 5]:</span>
<span class="n">x0</span><span class="p">,</span> <span class="n">x1</span><span class="p">,</span> <span class="n">x2</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">num_or_sections</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">dim</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="n">x0</span><span class="o">.</span><span class="n">shape</span> <span class="c1"># [3, 3, 5]</span>
<span class="n">x1</span><span class="o">.</span><span class="n">shape</span> <span class="c1"># [3, 3, 5]</span>
<span class="n">x2</span><span class="o">.</span><span class="n">shape</span> <span class="c1"># [3, 3, 5]</span>
<span class="n">x0</span><span class="p">,</span> <span class="n">x1</span><span class="p">,</span> <span class="n">x2</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">num_or_sections</span><span class="o">=</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span> <span class="n">dim</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="n">x0</span><span class="o">.</span><span class="n">shape</span> <span class="c1"># [3, 2, 5]</span>
<span class="n">x1</span><span class="o">.</span><span class="n">shape</span> <span class="c1"># [3, 3, 5]</span>
<span class="n">x2</span><span class="o">.</span><span class="n">shape</span> <span class="c1"># [3, 4, 5]</span>
</pre></div>
</div>
</dd></dl>
</div>
<div class="section" id="logsigmoid">
<h2>logsigmoid<a class="headerlink" href="#logsigmoid" title="Permalink to this headline"></a></h2>
......
......@@ -242,6 +242,46 @@
<code class="descclassname">paddle.v2.fluid.nets.</code><code class="descname">sequence_conv_pool</code><span class="sig-paren">(</span><em>input</em>, <em>num_filters</em>, <em>filter_size</em>, <em>param_attr=None</em>, <em>act='sigmoid'</em>, <em>pool_type='max'</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="glu">
<h2>glu<a class="headerlink" href="#glu" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.nets.</code><code class="descname">glu</code><span class="sig-paren">(</span><em>input</em>, <em>dim=-1</em><span class="sig-paren">)</span></dt>
<dd><p>The gated linear unit composed by split and elementwise multiplication.
Specifically, Split the input into two equal sized parts <span class="math">\(a\)</span> and
<span class="math">\(b\)</span> along the given dimension and then compute as following:</p>
<blockquote>
<div><div class="math">
\[{GLU}(a, b)= a \otimes \sigma(b)\]</div>
</div></blockquote>
<p>Refer to <a class="reference external" href="https://arxiv.org/pdf/1612.08083.pdf">Language Modeling with Gated Convolutional Networks</a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>input</strong> (<em>Variable</em>) &#8211; The input variable which is a Tensor or LoDTensor.</li>
<li><strong>dim</strong> (<em>int</em>) &#8211; The dimension along which to split. If <span class="math">\(dim &lt; 0\)</span>, the
dimension to split along is <span class="math">\(rank(input) + dim\)</span>.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The Tensor variable with half the size of input.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">Variable</p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="c1"># x is a Tensor variable with shape [3, 6, 9]</span>
<span class="n">fluid</span><span class="o">.</span><span class="n">nets</span><span class="o">.</span><span class="n">glu</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="n">x</span><span class="p">,</span> <span class="n">dim</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="c1"># shape of output: [3, 3, 9]</span>
</pre></div>
</div>
</dd></dl>
</div>
</div>
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -358,6 +358,12 @@ reduce_min
.. autofunction:: paddle.v2.fluid.layers.reduce_min
:noindex:
split
-----
.. autofunction:: paddle.v2.fluid.layers.split
:noindex:
logsigmoid
----------
.. autofunction:: paddle.v2.fluid.layers.logsigmoid
......
......@@ -20,3 +20,8 @@ sequence_conv_pool
:noindex:
glu
---
.. autofunction:: paddle.v2.fluid.nets.glu
:noindex:
......@@ -2453,6 +2453,52 @@ than the <code class="xref py py-attr docutils literal"><span class="pre">input<
</div>
</dd></dl>
</div>
<div class="section" id="split">
<h2>split<a class="headerlink" href="#split" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">split</code><span class="sig-paren">(</span><em>input</em>, <em>num_or_sections</em>, <em>dim=-1</em><span class="sig-paren">)</span></dt>
<dd><p>Splits the tensor into multiple sub-tensors.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">参数:</th><td class="field-body"><ul class="first simple">
<li><strong>input</strong> (<em>Variable</em>) &#8211; The input variable which is a Tensor or LoDTensor.</li>
<li><strong>num_or_sections</strong> (<em>int|list</em>) &#8211; If <code class="xref py py-attr docutils literal"><span class="pre">num_or_sections</span></code> is an integer,
then the integer indicates the number of equal sized sub-tensors
that the tensor will be divided into. If <code class="xref py py-attr docutils literal"><span class="pre">num_or_sections</span></code>
is a list of integers, the length of list indicates the number of
sub-tensors and the integers indicate the sizes of sub-tensors&#8217;
<code class="xref py py-attr docutils literal"><span class="pre">dim</span></code> dimension orderly.</li>
<li><strong>dim</strong> (<em>int</em>) &#8211; The dimension along which to split. If <span class="math">\(dim &lt; 0\)</span>, the
dimension to split along is <span class="math">\(rank(input) + dim\)</span>.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">The list of segmented tensor variables.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">List</p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="c1"># x is a Tensor variable with shape [3, 9, 5]:</span>
<span class="n">x0</span><span class="p">,</span> <span class="n">x1</span><span class="p">,</span> <span class="n">x2</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">num_or_sections</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">dim</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="n">x0</span><span class="o">.</span><span class="n">shape</span> <span class="c1"># [3, 3, 5]</span>
<span class="n">x1</span><span class="o">.</span><span class="n">shape</span> <span class="c1"># [3, 3, 5]</span>
<span class="n">x2</span><span class="o">.</span><span class="n">shape</span> <span class="c1"># [3, 3, 5]</span>
<span class="n">x0</span><span class="p">,</span> <span class="n">x1</span><span class="p">,</span> <span class="n">x2</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">num_or_sections</span><span class="o">=</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span> <span class="n">dim</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="n">x0</span><span class="o">.</span><span class="n">shape</span> <span class="c1"># [3, 2, 5]</span>
<span class="n">x1</span><span class="o">.</span><span class="n">shape</span> <span class="c1"># [3, 3, 5]</span>
<span class="n">x2</span><span class="o">.</span><span class="n">shape</span> <span class="c1"># [3, 4, 5]</span>
</pre></div>
</div>
</dd></dl>
</div>
<div class="section" id="logsigmoid">
<h2>logsigmoid<a class="headerlink" href="#logsigmoid" title="永久链接至标题"></a></h2>
......
......@@ -261,6 +261,46 @@
<code class="descclassname">paddle.v2.fluid.nets.</code><code class="descname">sequence_conv_pool</code><span class="sig-paren">(</span><em>input</em>, <em>num_filters</em>, <em>filter_size</em>, <em>param_attr=None</em>, <em>act='sigmoid'</em>, <em>pool_type='max'</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="glu">
<h2>glu<a class="headerlink" href="#glu" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.nets.</code><code class="descname">glu</code><span class="sig-paren">(</span><em>input</em>, <em>dim=-1</em><span class="sig-paren">)</span></dt>
<dd><p>The gated linear unit composed by split and elementwise multiplication.
Specifically, Split the input into two equal sized parts <span class="math">\(a\)</span> and
<span class="math">\(b\)</span> along the given dimension and then compute as following:</p>
<blockquote>
<div><div class="math">
\[{GLU}(a, b)= a \otimes \sigma(b)\]</div>
</div></blockquote>
<p>Refer to <a class="reference external" href="https://arxiv.org/pdf/1612.08083.pdf">Language Modeling with Gated Convolutional Networks</a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">参数:</th><td class="field-body"><ul class="first simple">
<li><strong>input</strong> (<em>Variable</em>) &#8211; The input variable which is a Tensor or LoDTensor.</li>
<li><strong>dim</strong> (<em>int</em>) &#8211; The dimension along which to split. If <span class="math">\(dim &lt; 0\)</span>, the
dimension to split along is <span class="math">\(rank(input) + dim\)</span>.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">The Tensor variable with half the size of input.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">Variable</p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="c1"># x is a Tensor variable with shape [3, 6, 9]</span>
<span class="n">fluid</span><span class="o">.</span><span class="n">nets</span><span class="o">.</span><span class="n">glu</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="n">x</span><span class="p">,</span> <span class="n">dim</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="c1"># shape of output: [3, 3, 9]</span>
</pre></div>
</div>
</dd></dl>
</div>
</div>
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册