提交 3a9a6be9 编写于 作者: T Travis CI

Deploy to GitHub Pages: 68c68ec9

上级 ceed547e
......@@ -1782,10 +1782,10 @@ each timestep of which is also a sequence.</li>
</ul>
<p>Accordingly, AggregateLevel supports two modes:</p>
<ul class="simple">
<li><code class="code docutils literal"><span class="pre">AggregateLevel.EACH_TIMESTEP</span></code> means the aggregation acts on each
<li><code class="code docutils literal"><span class="pre">AggregateLevel.TO_NO_SEQUENCE</span></code> means the aggregation acts on each
timestep of a sequence, both <code class="code docutils literal"><span class="pre">SUB_SEQUENCE</span></code> and <code class="code docutils literal"><span class="pre">SEQUENCE</span></code> will
be aggregated to <code class="code docutils literal"><span class="pre">NO_SEQUENCE</span></code>.</li>
<li><code class="code docutils literal"><span class="pre">AggregateLevel.EACH_SEQUENCE</span></code> means the aggregation acts on each
<li><code class="code docutils literal"><span class="pre">AggregateLevel.TO_SEQUENCE</span></code> means the aggregation acts on each
sequence of a nested sequence, <code class="code docutils literal"><span class="pre">SUB_SEQUENCE</span></code> will be aggregated to
<code class="code docutils literal"><span class="pre">SEQUENCE</span></code>.</li>
</ul>
......@@ -1801,7 +1801,7 @@ sequence of a nested sequence, <code class="code docutils literal"><span class="
<p>The example usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">seq_pool</span> <span class="o">=</span> <span class="n">pooling</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="n">layer</span><span class="p">,</span>
<span class="n">pooling_type</span><span class="o">=</span><span class="n">AvgPooling</span><span class="p">(),</span>
<span class="n">agg_level</span><span class="o">=</span><span class="n">AggregateLevel</span><span class="o">.</span><span class="n">EACH_SEQUENCE</span><span class="p">)</span>
<span class="n">agg_level</span><span class="o">=</span><span class="n">AggregateLevel</span><span class="o">.</span><span class="n">TO_NO_SEQUENCE</span><span class="p">)</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
......@@ -1809,8 +1809,8 @@ sequence of a nested sequence, <code class="code docutils literal"><span class="
<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>agg_level</strong> (<em>AggregateLevel</em>) &#8211; AggregateLevel.EACH_TIMESTEP or
AggregateLevel.EACH_SEQUENCE</li>
<li><strong>agg_level</strong> (<em>AggregateLevel</em>) &#8211; AggregateLevel.TO_NO_SEQUENCE or
AggregateLevel.TO_SEQUENCE</li>
<li><strong>name</strong> (<em>basestring</em>) &#8211; layer name.</li>
<li><strong>input</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; input layer name.</li>
<li><strong>pooling_type</strong> (<em>BasePoolingType|None</em>) &#8211; Type of pooling, MaxPooling(default), AvgPooling,
......@@ -2057,11 +2057,11 @@ convolution neural network, and before recurrent neural network.</p>
<dd><p>Please refer to AggregateLevel first.</p>
<p>ExpandLevel supports two modes:</p>
<ul class="simple">
<li><code class="code docutils literal"><span class="pre">ExpandLevel.FROM_TIMESTEP</span></code> means the expandation acts on each
timestep of a sequence, <code class="code docutils literal"><span class="pre">NO_SEQUENCE</span></code> will be expanded to
<li><code class="code docutils literal"><span class="pre">ExpandLevel.FROM_NO_SEQUENCE</span></code> means the expansion acts on
<code class="code docutils literal"><span class="pre">NO_SEQUENCE</span></code>, which will be expanded to
<code class="code docutils literal"><span class="pre">SEQUENCE</span></code> or <code class="code docutils literal"><span class="pre">SUB_SEQUENCE</span></code>.</li>
<li><code class="code docutils literal"><span class="pre">ExpandLevel.FROM_SEQUENCE</span></code> means the expandation acts on each
sequence of a nested sequence, <code class="code docutils literal"><span class="pre">SEQUENCE</span></code> will be expanded to
<li><code class="code docutils literal"><span class="pre">ExpandLevel.FROM_SEQUENCE</span></code> means the expansion acts on
<code class="code docutils literal"><span class="pre">SEQUENCE</span></code>, which will be expanded to
<code class="code docutils literal"><span class="pre">SUB_SEQUENCE</span></code>.</li>
</ul>
</dd></dl>
......@@ -2077,7 +2077,7 @@ sequence is one) to sequence data.&#8221;</p>
<p>The example usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">expand</span> <span class="o">=</span> <span class="n">expand</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="n">layer1</span><span class="p">,</span>
<span class="n">expand_as</span><span class="o">=</span><span class="n">layer2</span><span class="p">,</span>
<span class="n">expand_level</span><span class="o">=</span><span class="n">ExpandLevel</span><span class="o">.</span><span class="n">FROM_TIMESTEP</span><span class="p">)</span>
<span class="n">expand_level</span><span class="o">=</span><span class="n">ExpandLevel</span><span class="o">.</span><span class="n">FROM_NO_SEQUENCE</span><span class="p">)</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -28,17 +28,17 @@ pooling 的使用示例如下,详细见 :ref:`api_v2.layer_pooling` 配置API
seq_pool = pooling(input=layer,
pooling_type=pooling.Max(),
agg_level=AggregateLevel.EACH_SEQUENCE)
agg_level=AggregateLevel.TO_SEQUENCE)
- `pooling_type` 目前支持两种,分别是:pooling.Max()和pooling.Avg()。
- `agg_level=AggregateLevel.EACH_TIMESTEP` 时(默认值):
- `agg_level=AggregateLevel.TO_NO_SEQUENCE` 时(默认值):
- 作用:双层序列经过运算变成一个0层序列,或单层序列经过运算变成一个0层序列
- 输入:一个双层序列,或一个单层序列
- 输出:一个0层序列,即整个输入序列(单层或双层)的平均值(或最大值)
- `agg_level=AggregateLevel.EACH_SEQUENCE` 时:
- `agg_level=AggregateLevel.TO_SEQUENCE` 时:
- 作用:一个双层序列经过运算变成一个单层序列
- 输入:必须是一个双层序列
......@@ -52,15 +52,15 @@ last_seq 的使用示例如下( :ref:`api_v2.layer_first_seq` 类似),详
.. code-block:: bash
last = last_seq(input=layer,
agg_level=AggregateLevel.EACH_SEQUENCE)
agg_level=AggregateLevel.TO_SEQUENCE)
- `agg_level=AggregateLevel.EACH_TIMESTEP` 时(默认值):
- `agg_level=AggregateLevel.TO_NO_SEQUENCE` 时(默认值):
- 作用:一个双层序列经过运算变成一个0层序列,或一个单层序列经过运算变成一个0层序列
- 输入:一个双层序列或一个单层序列
- 输出:一个0层序列,即整个输入序列(双层或者单层)最后一个,或第一个元素。
- `agg_level=AggregateLevel.EACH_SEQUENCE` 时:
- `agg_level=AggregateLevel.TO_SEQUENCE` 时:
- 作用:一个双层序列经过运算变成一个单层序列
- 输入:必须是一个双层序列
- 输出:一个单层序列,其中每个元素是双层序列中每个subseq最后一个(或第一个)元素。
......@@ -74,9 +74,9 @@ expand 的使用示例如下,详细见 :ref:`api_v2.layer_expand` 配置API。
ex = expand(input=layer1,
expand_as=layer2,
expand_level=ExpandLevel.FROM_TIMESTEP)
expand_level=ExpandLevel.FROM_NO_SEQUENCE)
- `expand_level=ExpandLevel.FROM_TIMESTEP` 时(默认值):
- `expand_level=ExpandLevel.FROM_NO_SEQUENCE` 时(默认值):
- 作用:一个0层序列经过运算扩展成一个单层序列,或者一个双层序列
- 输入:layer1必须是一个0层序列,是待扩展的数据;layer2 可以是一个单层序列,或者是一个双层序列,提供扩展的长度信息
......
......@@ -81,7 +81,7 @@
* 在本例中,我们将原始数据的每一组,通过\ :code:`recurrent_group`\ 进行拆解,拆解成的每一句话再通过一个LSTM网络。这和单层RNN的配置是等价的。
* 与单层RNN的配置类似,我们只需要使用LSTM encode成的最后一个向量。所以对\ :code:`recurrent_group`\ 进行了\ :code:`last_seq`\ 操作。但和单层RNN不同,我们是对每一个子序列取最后一个元素,因此\ :code:`agg_level=AggregateLevel.EACH_SEQUENCE`\ 。
* 与单层RNN的配置类似,我们只需要使用LSTM encode成的最后一个向量。所以对\ :code:`recurrent_group`\ 进行了\ :code:`last_seq`\ 操作。但和单层RNN不同,我们是对每一个子序列取最后一个元素,因此\ :code:`agg_level=AggregateLevel.TO_SEQUENCE`\ 。
* 至此,\ :code:`lstm_last`\ 便和单层RNN配置中的\ :code:`lstm_last`\ 具有相同的结果了。
......
......@@ -1789,10 +1789,10 @@ each timestep of which is also a sequence.</li>
</ul>
<p>Accordingly, AggregateLevel supports two modes:</p>
<ul class="simple">
<li><code class="code docutils literal"><span class="pre">AggregateLevel.EACH_TIMESTEP</span></code> means the aggregation acts on each
<li><code class="code docutils literal"><span class="pre">AggregateLevel.TO_NO_SEQUENCE</span></code> means the aggregation acts on each
timestep of a sequence, both <code class="code docutils literal"><span class="pre">SUB_SEQUENCE</span></code> and <code class="code docutils literal"><span class="pre">SEQUENCE</span></code> will
be aggregated to <code class="code docutils literal"><span class="pre">NO_SEQUENCE</span></code>.</li>
<li><code class="code docutils literal"><span class="pre">AggregateLevel.EACH_SEQUENCE</span></code> means the aggregation acts on each
<li><code class="code docutils literal"><span class="pre">AggregateLevel.TO_SEQUENCE</span></code> means the aggregation acts on each
sequence of a nested sequence, <code class="code docutils literal"><span class="pre">SUB_SEQUENCE</span></code> will be aggregated to
<code class="code docutils literal"><span class="pre">SEQUENCE</span></code>.</li>
</ul>
......@@ -1808,7 +1808,7 @@ sequence of a nested sequence, <code class="code docutils literal"><span class="
<p>The example usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">seq_pool</span> <span class="o">=</span> <span class="n">pooling</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="n">layer</span><span class="p">,</span>
<span class="n">pooling_type</span><span class="o">=</span><span class="n">AvgPooling</span><span class="p">(),</span>
<span class="n">agg_level</span><span class="o">=</span><span class="n">AggregateLevel</span><span class="o">.</span><span class="n">EACH_SEQUENCE</span><span class="p">)</span>
<span class="n">agg_level</span><span class="o">=</span><span class="n">AggregateLevel</span><span class="o">.</span><span class="n">TO_NO_SEQUENCE</span><span class="p">)</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
......@@ -1816,8 +1816,8 @@ sequence of a nested sequence, <code class="code docutils literal"><span class="
<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>agg_level</strong> (<em>AggregateLevel</em>) &#8211; AggregateLevel.EACH_TIMESTEP or
AggregateLevel.EACH_SEQUENCE</li>
<li><strong>agg_level</strong> (<em>AggregateLevel</em>) &#8211; AggregateLevel.TO_NO_SEQUENCE or
AggregateLevel.TO_SEQUENCE</li>
<li><strong>name</strong> (<em>basestring</em>) &#8211; layer name.</li>
<li><strong>input</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; input layer name.</li>
<li><strong>pooling_type</strong> (<em>BasePoolingType|None</em>) &#8211; Type of pooling, MaxPooling(default), AvgPooling,
......@@ -2064,11 +2064,11 @@ convolution neural network, and before recurrent neural network.</p>
<dd><p>Please refer to AggregateLevel first.</p>
<p>ExpandLevel supports two modes:</p>
<ul class="simple">
<li><code class="code docutils literal"><span class="pre">ExpandLevel.FROM_TIMESTEP</span></code> means the expandation acts on each
timestep of a sequence, <code class="code docutils literal"><span class="pre">NO_SEQUENCE</span></code> will be expanded to
<li><code class="code docutils literal"><span class="pre">ExpandLevel.FROM_NO_SEQUENCE</span></code> means the expansion acts on
<code class="code docutils literal"><span class="pre">NO_SEQUENCE</span></code>, which will be expanded to
<code class="code docutils literal"><span class="pre">SEQUENCE</span></code> or <code class="code docutils literal"><span class="pre">SUB_SEQUENCE</span></code>.</li>
<li><code class="code docutils literal"><span class="pre">ExpandLevel.FROM_SEQUENCE</span></code> means the expandation acts on each
sequence of a nested sequence, <code class="code docutils literal"><span class="pre">SEQUENCE</span></code> will be expanded to
<li><code class="code docutils literal"><span class="pre">ExpandLevel.FROM_SEQUENCE</span></code> means the expansion acts on
<code class="code docutils literal"><span class="pre">SEQUENCE</span></code>, which will be expanded to
<code class="code docutils literal"><span class="pre">SUB_SEQUENCE</span></code>.</li>
</ul>
</dd></dl>
......@@ -2084,7 +2084,7 @@ sequence is one) to sequence data.&#8221;</p>
<p>The example usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">expand</span> <span class="o">=</span> <span class="n">expand</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="n">layer1</span><span class="p">,</span>
<span class="n">expand_as</span><span class="o">=</span><span class="n">layer2</span><span class="p">,</span>
<span class="n">expand_level</span><span class="o">=</span><span class="n">ExpandLevel</span><span class="o">.</span><span class="n">FROM_TIMESTEP</span><span class="p">)</span>
<span class="n">expand_level</span><span class="o">=</span><span class="n">ExpandLevel</span><span class="o">.</span><span class="n">FROM_NO_SEQUENCE</span><span class="p">)</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
......
......@@ -221,18 +221,18 @@
<p>pooling 的使用示例如下,详细见 <a class="reference internal" href="../../../api/v2/config/layer.html#api-v2-layer-pooling"><span class="std std-ref">pooling</span></a> 配置API。</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="nv">seq_pool</span> <span class="o">=</span> pooling<span class="o">(</span><span class="nv">input</span><span class="o">=</span>layer,
<span class="nv">pooling_type</span><span class="o">=</span>pooling.Max<span class="o">()</span>,
<span class="nv">agg_level</span><span class="o">=</span>AggregateLevel.EACH_SEQUENCE<span class="o">)</span>
<span class="nv">agg_level</span><span class="o">=</span>AggregateLevel.TO_SEQUENCE<span class="o">)</span>
</pre></div>
</div>
<ul class="simple">
<li><cite>pooling_type</cite> 目前支持两种,分别是:pooling.Max()和pooling.Avg()。</li>
<li><cite>agg_level=AggregateLevel.EACH_TIMESTEP</cite> 时(默认值):<ul>
<li><cite>agg_level=AggregateLevel.TO_NO_SEQUENCE</cite> 时(默认值):<ul>
<li>作用:双层序列经过运算变成一个0层序列,或单层序列经过运算变成一个0层序列</li>
<li>输入:一个双层序列,或一个单层序列</li>
<li>输出:一个0层序列,即整个输入序列(单层或双层)的平均值(或最大值)</li>
</ul>
</li>
<li><cite>agg_level=AggregateLevel.EACH_SEQUENCE</cite> 时:<ul>
<li><cite>agg_level=AggregateLevel.TO_SEQUENCE</cite> 时:<ul>
<li>作用:一个双层序列经过运算变成一个单层序列</li>
<li>输入:必须是一个双层序列</li>
<li>输出:一个单层序列,序列的每个元素是原来双层序列每个subseq元素的平均值(或最大值)</li>
......@@ -244,17 +244,17 @@
<h2><a class="toc-backref" href="#id5">last_seq 和 first_seq</a><a class="headerlink" href="#last-seq-first-seq" title="永久链接至标题"></a></h2>
<p>last_seq 的使用示例如下( <a class="reference internal" href="../../../api/v2/config/layer.html#api-v2-layer-first-seq"><span class="std std-ref">first_seq</span></a> 类似),详细见 <a class="reference internal" href="../../../api/v2/config/layer.html#api-v2-layer-last-seq"><span class="std std-ref">last_seq</span></a> 配置API。</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="nv">last</span> <span class="o">=</span> last_seq<span class="o">(</span><span class="nv">input</span><span class="o">=</span>layer,
<span class="nv">agg_level</span><span class="o">=</span>AggregateLevel.EACH_SEQUENCE<span class="o">)</span>
<span class="nv">agg_level</span><span class="o">=</span>AggregateLevel.TO_SEQUENCE<span class="o">)</span>
</pre></div>
</div>
<ul class="simple">
<li><cite>agg_level=AggregateLevel.EACH_TIMESTEP</cite> 时(默认值):<ul>
<li><cite>agg_level=AggregateLevel.TO_NO_SEQUENCE</cite> 时(默认值):<ul>
<li>作用:一个双层序列经过运算变成一个0层序列,或一个单层序列经过运算变成一个0层序列</li>
<li>输入:一个双层序列或一个单层序列</li>
<li>输出:一个0层序列,即整个输入序列(双层或者单层)最后一个,或第一个元素。</li>
</ul>
</li>
<li><cite>agg_level=AggregateLevel.EACH_SEQUENCE</cite> 时:
<li><cite>agg_level=AggregateLevel.TO_SEQUENCE</cite> 时:
- 作用:一个双层序列经过运算变成一个单层序列
- 输入:必须是一个双层序列
- 输出:一个单层序列,其中每个元素是双层序列中每个subseq最后一个(或第一个)元素。</li>
......@@ -265,11 +265,11 @@
<p>expand 的使用示例如下,详细见 <a class="reference internal" href="../../../api/v2/config/layer.html#api-v2-layer-expand"><span class="std std-ref">ExpandLevel</span></a> 配置API。</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="nv">ex</span> <span class="o">=</span> expand<span class="o">(</span><span class="nv">input</span><span class="o">=</span>layer1,
<span class="nv">expand_as</span><span class="o">=</span>layer2,
<span class="nv">expand_level</span><span class="o">=</span>ExpandLevel.FROM_TIMESTEP<span class="o">)</span>
<span class="nv">expand_level</span><span class="o">=</span>ExpandLevel.FROM_NO_SEQUENCE<span class="o">)</span>
</pre></div>
</div>
<ul class="simple">
<li><cite>expand_level=ExpandLevel.FROM_TIMESTEP</cite> 时(默认值):<ul>
<li><cite>expand_level=ExpandLevel.FROM_NO_SEQUENCE</cite> 时(默认值):<ul>
<li>作用:一个0层序列经过运算扩展成一个单层序列,或者一个双层序列</li>
<li>输入:layer1必须是一个0层序列,是待扩展的数据;layer2 可以是一个单层序列,或者是一个双层序列,提供扩展的长度信息</li>
<li>输出:一个单层序列或一个双层序列,输出序列的类型(双层序列或单层序列)和序列中含有元素的数目同 layer2 一致。若输出是单层序列,单层序列的每个元素(0层序列),都是对layer1元素的拷贝;若输出是双层序列,双层序列每个subseq中每个元素(0层序列),都是对layer1元素的拷贝</li>
......
......@@ -419,7 +419,7 @@
<li>在本例中,我们将原始数据的每一组,通过<code class="code docutils literal"><span class="pre">recurrent_group</span></code>进行拆解,拆解成的每一句话再通过一个LSTM网络。这和单层RNN的配置是等价的。</li>
</ul>
</li>
<li>与单层RNN的配置类似,我们只需要使用LSTM encode成的最后一个向量。所以对<code class="code docutils literal"><span class="pre">recurrent_group</span></code>进行了<code class="code docutils literal"><span class="pre">last_seq</span></code>操作。但和单层RNN不同,我们是对每一个子序列取最后一个元素,因此<code class="code docutils literal"><span class="pre">agg_level=AggregateLevel.EACH_SEQUENCE</span></code></li>
<li>与单层RNN的配置类似,我们只需要使用LSTM encode成的最后一个向量。所以对<code class="code docutils literal"><span class="pre">recurrent_group</span></code>进行了<code class="code docutils literal"><span class="pre">last_seq</span></code>操作。但和单层RNN不同,我们是对每一个子序列取最后一个元素,因此<code class="code docutils literal"><span class="pre">agg_level=AggregateLevel.TO_SEQUENCE</span></code></li>
<li>至此,<code class="code docutils literal"><span class="pre">lstm_last</span></code>便和单层RNN配置中的<code class="code docutils literal"><span class="pre">lstm_last</span></code>具有相同的结果了。</li>
</ul>
<div class="highlight-python"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
......@@ -472,7 +472,7 @@
</span><span class="hll"> <span class="nb">input</span><span class="o">=</span><span class="n">SubsequenceInput</span><span class="p">(</span><span class="n">emb_group</span><span class="p">),</span> <span class="n">step</span><span class="o">=</span><span class="n">lstm_group</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s2">&quot;lstm_nest_group&quot;</span><span class="p">)</span>
</span><span class="hll"><span class="c1"># hasSubseq -&gt;(seqlastins) seq</span>
</span><span class="hll"><span class="n">lstm_last</span> <span class="o">=</span> <span class="n">last_seq</span><span class="p">(</span>
</span><span class="hll"> <span class="nb">input</span><span class="o">=</span><span class="n">lstm_nest_group</span><span class="p">,</span> <span class="n">agg_level</span><span class="o">=</span><span class="n">AggregateLevel</span><span class="o">.</span><span class="n">EACH_SEQUENCE</span><span class="p">)</span>
</span><span class="hll"> <span class="nb">input</span><span class="o">=</span><span class="n">lstm_nest_group</span><span class="p">,</span> <span class="n">agg_level</span><span class="o">=</span><span class="n">AggregateLevel</span><span class="o">.</span><span class="n">TO_SEQUENCE</span><span class="p">)</span>
</span><span class="hll">
</span><span class="c1"># seq -&gt;(expand) hasSubseq</span>
</pre></div>
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册