提交 546fa1a8 编写于 作者: T Travis CI

Deploy to GitHub Pages: 624d22d9

上级 ad7f6583
......@@ -87,6 +87,11 @@ roi_pool
.. autoclass:: paddle.v2.layer.roi_pool
:noindex:
pad
----
.. autoclass:: paddle.v2.layer.pad
:noindex:
Norm Layer
==========
......@@ -133,6 +138,11 @@ grumemory
.. autoclass:: paddle.v2.layer.grumemory
:noindex:
gated_unit
-----------
.. autoclass:: paddle.v2.layer.gated_unit
:noindex:
Recurrent Layer Group
=====================
......@@ -340,6 +350,11 @@ bilinear_interp
.. autoclass:: paddle.v2.layer.bilinear_interp
:noindex:
dropout
--------
.. autoclass:: paddle.v2.layer.dropout
:noindex:
dot_prod
---------
.. autoclass:: paddle.v2.layer.dot_prod
......@@ -402,6 +417,11 @@ scale_shift
.. autoclass:: paddle.v2.layer.scale_shift
:noindex:
factorization_machine
---------------------
.. autoclass:: paddle.v2.layer.factorization_machine
:noindex:
Sampling Layers
===============
......@@ -420,22 +440,6 @@ multiplex
.. autoclass:: paddle.v2.layer.multiplex
:noindex:
Factorization Machine Layer
============================
factorization_machine
---------------------
.. autoclass:: paddle.v2.layer.factorization_machine
:noindex:
Slicing and Joining Layers
==========================
pad
----
.. autoclass:: paddle.v2.layer.pad
:noindex:
.. _api_v2.layer_costs:
Cost Layers
......@@ -526,6 +530,11 @@ multibox_loss
.. autoclass:: paddle.v2.layer.multibox_loss
:noindex:
detection_output
----------------
.. autoclass:: paddle.v2.layer.detection_output
:noindex:
Check Layer
============
......@@ -534,31 +543,10 @@ eos
.. autoclass:: paddle.v2.layer.eos
:noindex:
Miscs
=====
dropout
--------
.. autoclass:: paddle.v2.layer.dropout
:noindex:
Activation with learnable parameter
===================================
Activation
==========
prelu
--------
.. autoclass:: paddle.v2.layer.prelu
:noindex:
gated_unit
-----------
.. autoclass:: paddle.v2.layer.gated_unit
:noindex:
Detection output Layer
======================
detection_output
----------------
.. autoclass:: paddle.v2.layer.detection_output
:noindex:
......@@ -73,3 +73,10 @@ wmt14
.. automodule:: paddle.v2.dataset.wmt14
:members:
:noindex:
wmt16
+++++
.. automodule:: paddle.v2.dataset.wmt16
:members:
:noindex:
......@@ -911,6 +911,73 @@ feature map.</p>
</table>
</dd></dl>
</div>
<div class="section" id="pad">
<h3>pad<a class="headerlink" href="#pad" title="Permalink to this headline"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">pad</code></dt>
<dd><p>This operation pads zeros to the input data according to pad_c,pad_h
and pad_w. pad_c, pad_h, pad_w specify the size in the corresponding
dimension. And the input data shape is NCHW.</p>
<p>For example, pad_c=[2,3] means padding 2 zeros before the input data
and 3 zeros after the input data in the channel dimension. pad_h means
padding zeros in the height dimension. pad_w means padding zeros in the
width dimension.</p>
<p>For example,</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="nb">input</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</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="o">=</span> <span class="p">[</span>
<span class="p">[</span> <span class="p">[[</span><span class="mi">1</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="p">[</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">]],</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">5</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span><span class="mi">7</span><span class="p">]]</span> <span class="p">],</span>
<span class="p">[</span> <span class="p">[[</span><span class="mi">4</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">7</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">3</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">9</span><span class="p">],</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">5</span><span class="p">]]</span> <span class="p">]</span>
<span class="p">]</span>
<span class="n">pad_c</span><span class="o">=</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span> <span class="n">pad_h</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="n">pad_w</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]</span>
<span class="n">output</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">4</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="o">=</span> <span class="p">[</span>
<span class="p">[</span> <span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">1</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="p">[</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">]],</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">5</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span><span class="mi">7</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]]</span> <span class="p">],</span>
<span class="p">[</span> <span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">4</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">7</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">3</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">9</span><span class="p">],</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">5</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]]</span> <span class="p">]</span>
<span class="p">]</span>
</pre></div>
</div>
<p>The simply usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">pad</span> <span class="o">=</span> <span class="n">pad</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="n">ipt</span><span class="p">,</span>
<span class="n">pad_c</span><span class="o">=</span><span class="p">[</span><span class="mi">4</span><span class="p">,</span><span class="mi">4</span><span class="p">],</span>
<span class="n">pad_h</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span>
<span class="n">pad_w</span><span class="o">=</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">])</span>
</pre></div>
</div>
<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>paddle.v2.config_base.Layer</em>) &#8211; The input of this layer.</li>
<li><strong>pad_c</strong> (<em>list | None</em>) &#8211; The padding size in the channel dimension.</li>
<li><strong>pad_h</strong> (<em>list | None</em>) &#8211; The padding size in the height dimension.</li>
<li><strong>pad_w</strong> (<em>list | None</em>) &#8211; The padding size in the width dimension.</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttribute</em>) &#8211; The extra layer attribute. See paddle.v2.attr.ExtraAttribute for
details.</li>
<li><strong>name</strong> (<em>basestring</em>) &#8211; The name of this layer. It is optional.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">paddle.v2.config_base.Layer object.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">paddle.v2.config_base.Layer</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
<div class="section" id="norm-layer">
......@@ -1316,6 +1383,62 @@ details.</li>
</table>
</dd></dl>
</div>
<div class="section" id="gated-unit">
<h3>gated_unit<a class="headerlink" href="#gated-unit" title="Permalink to this headline"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">gated_unit</code></dt>
<dd><p>The gated unit layer implements a simple gating mechanism over the input.
The input <span class="math">\(X\)</span> is first projected into a new space <span class="math">\(X'\)</span>, and
it is also used to produce a gate weight <span class="math">\(\sigma\)</span>. Element-wise
product between <span class="math">\(X'\)</span> and <span class="math">\(\sigma\)</span> is finally returned.</p>
<dl class="docutils">
<dt>Reference:</dt>
<dd><a class="reference external" href="https://arxiv.org/abs/1612.08083">Language Modeling with Gated Convolutional Networks</a></dd>
</dl>
<div class="math">
\[y=\text{act}(X \cdot W + b)\otimes \sigma(X \cdot V + c)\]</div>
<p>The example usage is:</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>paddle.v2.config_base.Layer</em>) &#8211; The input of this layer.</li>
<li><strong>size</strong> (<em>int</em>) &#8211; The dimension of this layer&#8217;s output.</li>
<li><strong>act</strong> (<em>paddle.v2.activation.Base</em>) &#8211; Activation type of the projection. paddle.v2.activation.Linear is the default
activation.</li>
<li><strong>name</strong> (<em>basestring</em>) &#8211; The name of this layer. It is optional.</li>
<li><strong>gate_attr</strong> (<em>paddle.v2.attr.ExtraAttribute | None</em>) &#8211; The extra layer attribute of the gate. See paddle.v2.attr.ExtraAttribute for
details.</li>
<li><strong>gate_param_attr</strong> (<em>paddle.v2.attr.ParameterAttribute</em>) &#8211; The parameter attribute of the gate. See paddle.v2.attr.ParameterAttribute
for details.</li>
<li><strong>gate_bias_attr</strong> (<em>paddle.v2.attr.ParameterAttribute | bool | None | Any</em>) &#8211; The bias attribute of the gate. If this parameter is set to False or
an object whose type is not paddle.v2.attr.ParameterAttribute, no bias is defined.
If this parameter is set to True, the bias is initialized to zero.</li>
<li><strong>inproj_attr</strong> (<em>paddle.v2.attr.ExtraAttribute | None</em>) &#8211; Extra layer attributes of the projection. See paddle.v2.attr.ExtraAttribute for
details.</li>
<li><strong>inproj_param_attr</strong> (<em>paddle.v2.attr.ParameterAttribute</em>) &#8211; The parameter attribute of the projection. See paddle.v2.attr.ParameterAttribute
for details.</li>
<li><strong>inproj_bias_attr</strong> (<em>paddle.v2.attr.ParameterAttribute | bool | None | Any</em>) &#8211; The bias attribute of the projection. If this parameter is set to False
or an object whose type is not paddle.v2.attr.ParameterAttribute, no bias is defined.
If this parameter is set to True, the bias is initialized to zero.</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttribute | None</em>) &#8211; Extra layer attribute of the product. See paddle.v2.attr.ExtraAttribute for
details.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">paddle.v2.config_base.Layer object.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">paddle.v2.config_base.Layer</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
<div class="section" id="recurrent-layer-group">
......@@ -2876,6 +2999,37 @@ details.</li>
</table>
</dd></dl>
</div>
<div class="section" id="dropout">
<h3>dropout<a class="headerlink" href="#dropout" title="Permalink to this headline"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">dropout</code></dt>
<dd><p>The example usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">dropout</span> <span class="o">=</span> <span class="n">dropout</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="nb">input</span><span class="p">,</span> <span class="n">dropout_rate</span><span class="o">=</span><span class="mf">0.5</span><span class="p">)</span>
</pre></div>
</div>
<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>name</strong> (<em>basestring</em>) &#8211; The name of this layer. It is optional.</li>
<li><strong>input</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; The input of this layer.</li>
<li><strong>dropout_rate</strong> (<em>float</em>) &#8211; The probability of dropout.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">paddle.v2.config_base.Layer object.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">paddle.v2.config_base.Layer</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="dot-prod">
<h3>dot_prod<a class="headerlink" href="#dot-prod" title="Permalink to this headline"></a></h3>
......@@ -3344,6 +3498,54 @@ parameter is set to True, the bias is initialized to zero.</li>
</table>
</dd></dl>
</div>
<div class="section" id="factorization-machine">
<h3>factorization_machine<a class="headerlink" href="#factorization-machine" title="Permalink to this headline"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">factorization_machine</code></dt>
<dd><p>The Factorization Machine models pairwise feature interactions as inner
product of the learned latent vectors corresponding to each input feature.
The Factorization Machine can effectively capture feature interactions
especially when the input is sparse.</p>
<p>This implementation only consider the 2-order feature interactions using
Factorization Machine with the formula:</p>
<div class="math">
\[y = \sum_{i=1}^{n-1}\sum_{j=i+1}^n\langle v_i, v_j \rangle x_i x_j\]</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">X is the input vector with size n. V is the factor matrix. Each row of V
is the latent vector corresponding to each input dimesion. The size of
each latent vector is k.</p>
</div>
<p>For details of Factorization Machine, please refer to the paper:
Factorization machines.</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>paddle.v2.config_base.Layer</em>) &#8211; The input layer. Supported input types: all input data types
on CPU, and only dense input types on GPU.</li>
<li><strong>factor_size</strong> &#8211; The hyperparameter that defines the dimensionality of
the latent vector size.</li>
<li><strong>act</strong> (<em>paddle.v2.activation.Base</em>) &#8211; Activation Type. Default is linear activation.</li>
<li><strong>param_attr</strong> (<em>paddle.v2.attr.ParameterAttribute</em>) &#8211; The parameter attribute. See paddle.v2.attr.ParameterAttribute for
details.</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttributeNone</em>) &#8211; Extra Layer config.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">paddle.v2.config_base.Layer object.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">paddle.v2.config_base.Layer</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
<div class="section" id="sampling-layers">
......@@ -3460,127 +3662,6 @@ details.</li>
</table>
</dd></dl>
</div>
</div>
<div class="section" id="factorization-machine-layer">
<h2>Factorization Machine Layer<a class="headerlink" href="#factorization-machine-layer" title="Permalink to this headline"></a></h2>
<div class="section" id="factorization-machine">
<h3>factorization_machine<a class="headerlink" href="#factorization-machine" title="Permalink to this headline"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">factorization_machine</code></dt>
<dd><p>The Factorization Machine models pairwise feature interactions as inner
product of the learned latent vectors corresponding to each input feature.
The Factorization Machine can effectively capture feature interactions
especially when the input is sparse.</p>
<p>This implementation only consider the 2-order feature interactions using
Factorization Machine with the formula:</p>
<div class="math">
\[y = \sum_{i=1}^{n-1}\sum_{j=i+1}^n\langle v_i, v_j \rangle x_i x_j\]</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">X is the input vector with size n. V is the factor matrix. Each row of V
is the latent vector corresponding to each input dimesion. The size of
each latent vector is k.</p>
</div>
<p>For details of Factorization Machine, please refer to the paper:
Factorization machines.</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>paddle.v2.config_base.Layer</em>) &#8211; The input layer. Supported input types: all input data types
on CPU, and only dense input types on GPU.</li>
<li><strong>factor_size</strong> &#8211; The hyperparameter that defines the dimensionality of
the latent vector size.</li>
<li><strong>act</strong> (<em>paddle.v2.activation.Base</em>) &#8211; Activation Type. Default is linear activation.</li>
<li><strong>param_attr</strong> (<em>paddle.v2.attr.ParameterAttribute</em>) &#8211; The parameter attribute. See paddle.v2.attr.ParameterAttribute for
details.</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttributeNone</em>) &#8211; Extra Layer config.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">paddle.v2.config_base.Layer object.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">paddle.v2.config_base.Layer</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
<div class="section" id="slicing-and-joining-layers">
<h2>Slicing and Joining Layers<a class="headerlink" href="#slicing-and-joining-layers" title="Permalink to this headline"></a></h2>
<div class="section" id="pad">
<h3>pad<a class="headerlink" href="#pad" title="Permalink to this headline"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">pad</code></dt>
<dd><p>This operation pads zeros to the input data according to pad_c,pad_h
and pad_w. pad_c, pad_h, pad_w specify the size in the corresponding
dimension. And the input data shape is NCHW.</p>
<p>For example, pad_c=[2,3] means padding 2 zeros before the input data
and 3 zeros after the input data in the channel dimension. pad_h means
padding zeros in the height dimension. pad_w means padding zeros in the
width dimension.</p>
<p>For example,</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="nb">input</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</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="o">=</span> <span class="p">[</span>
<span class="p">[</span> <span class="p">[[</span><span class="mi">1</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="p">[</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">]],</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">5</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span><span class="mi">7</span><span class="p">]]</span> <span class="p">],</span>
<span class="p">[</span> <span class="p">[[</span><span class="mi">4</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">7</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">3</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">9</span><span class="p">],</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">5</span><span class="p">]]</span> <span class="p">]</span>
<span class="p">]</span>
<span class="n">pad_c</span><span class="o">=</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span> <span class="n">pad_h</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="n">pad_w</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]</span>
<span class="n">output</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">4</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="o">=</span> <span class="p">[</span>
<span class="p">[</span> <span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">1</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="p">[</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">]],</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">5</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span><span class="mi">7</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]]</span> <span class="p">],</span>
<span class="p">[</span> <span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">4</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">7</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">3</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">9</span><span class="p">],</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">5</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]]</span> <span class="p">]</span>
<span class="p">]</span>
</pre></div>
</div>
<p>The simply usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">pad</span> <span class="o">=</span> <span class="n">pad</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="n">ipt</span><span class="p">,</span>
<span class="n">pad_c</span><span class="o">=</span><span class="p">[</span><span class="mi">4</span><span class="p">,</span><span class="mi">4</span><span class="p">],</span>
<span class="n">pad_h</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span>
<span class="n">pad_w</span><span class="o">=</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">])</span>
</pre></div>
</div>
<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>paddle.v2.config_base.Layer</em>) &#8211; The input of this layer.</li>
<li><strong>pad_c</strong> (<em>list | None</em>) &#8211; The padding size in the channel dimension.</li>
<li><strong>pad_h</strong> (<em>list | None</em>) &#8211; The padding size in the height dimension.</li>
<li><strong>pad_w</strong> (<em>list | None</em>) &#8211; The padding size in the width dimension.</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttribute</em>) &#8211; The extra layer attribute. See paddle.v2.attr.ExtraAttribute for
details.</li>
<li><strong>name</strong> (<em>basestring</em>) &#8211; The name of this layer. It is optional.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">paddle.v2.config_base.Layer object.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">paddle.v2.config_base.Layer</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
<div class="section" id="cost-layers">
......@@ -4346,32 +4427,29 @@ the positive bounding box.</li>
</dd></dl>
</div>
</div>
<div class="section" id="check-layer">
<h2>Check Layer<a class="headerlink" href="#check-layer" title="Permalink to this headline"></a></h2>
<div class="section" id="eos">
<h3>eos<a class="headerlink" href="#eos" title="Permalink to this headline"></a></h3>
<div class="section" id="detection-output">
<h3>detection_output<a class="headerlink" href="#detection-output" title="Permalink to this headline"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">eos</code></dt>
<dd><p>A layer for checking EOS for each sample:
- output_id = (input_id == conf.eos_id)</p>
<p>The result is stored in output_.ids.
It is used by recurrent layer group.</p>
<p>The example usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">eos</span> <span class="o">=</span> <span class="n">eos</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">eos_id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
</pre></div>
</div>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">detection_output</code></dt>
<dd><p>Apply the NMS to the output of network and compute the predict bounding
box location. The output&#8217;s shape of this layer could be zero if there is
no valid bounding box.</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>name</strong> (<em>basestring</em>) &#8211; The name of this layer. It is optional.</li>
<li><strong>input</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; The input of this layer.</li>
<li><strong>eos_id</strong> (<em>int</em>) &#8211; End id of sequence</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttribute</em>) &#8211; The extra layer attribute. See paddle.v2.attr.ExtraAttribute for
details.</li>
<li><strong>input_loc</strong> (<em>paddle.v2.config_base.Layer | List of paddle.v2.config_base.Layer.</em>) &#8211; The input predict locations.</li>
<li><strong>input_conf</strong> (<em>paddle.v2.config_base.Layer | List of paddle.v2.config_base.Layer.</em>) &#8211; The input priorbox confidence.</li>
<li><strong>priorbox</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; The input priorbox location and the variance.</li>
<li><strong>num_classes</strong> (<em>int</em>) &#8211; The number of the classes.</li>
<li><strong>nms_threshold</strong> (<em>float</em>) &#8211; The Non-maximum suppression threshold.</li>
<li><strong>nms_top_k</strong> (<em>int</em>) &#8211; The bounding boxes number kept of the NMS&#8217;s output.</li>
<li><strong>keep_top_k</strong> (<em>int</em>) &#8211; The bounding boxes number kept of the layer&#8217;s output.</li>
<li><strong>confidence_threshold</strong> (<em>float</em>) &#8211; The classification confidence threshold.</li>
<li><strong>background_id</strong> (<em>int</em>) &#8211; The background class index.</li>
</ul>
</td>
</tr>
......@@ -4387,15 +4465,19 @@ details.</li>
</div>
</div>
<div class="section" id="miscs">
<h2>Miscs<a class="headerlink" href="#miscs" title="Permalink to this headline"></a></h2>
<div class="section" id="dropout">
<h3>dropout<a class="headerlink" href="#dropout" title="Permalink to this headline"></a></h3>
<div class="section" id="check-layer">
<h2>Check Layer<a class="headerlink" href="#check-layer" title="Permalink to this headline"></a></h2>
<div class="section" id="eos">
<h3>eos<a class="headerlink" href="#eos" title="Permalink to this headline"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">dropout</code></dt>
<dd><p>The example usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">dropout</span> <span class="o">=</span> <span class="n">dropout</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="nb">input</span><span class="p">,</span> <span class="n">dropout_rate</span><span class="o">=</span><span class="mf">0.5</span><span class="p">)</span>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">eos</code></dt>
<dd><p>A layer for checking EOS for each sample:
- output_id = (input_id == conf.eos_id)</p>
<p>The result is stored in output_.ids.
It is used by recurrent layer group.</p>
<p>The example usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">eos</span> <span class="o">=</span> <span class="n">eos</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">eos_id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
......@@ -4405,7 +4487,9 @@ details.</li>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>name</strong> (<em>basestring</em>) &#8211; The name of this layer. It is optional.</li>
<li><strong>input</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; The input of this layer.</li>
<li><strong>dropout_rate</strong> (<em>float</em>) &#8211; The probability of dropout.</li>
<li><strong>eos_id</strong> (<em>int</em>) &#8211; End id of sequence</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttribute</em>) &#8211; The extra layer attribute. See paddle.v2.attr.ExtraAttribute for
details.</li>
</ul>
</td>
</tr>
......@@ -4421,8 +4505,8 @@ details.</li>
</div>
</div>
<div class="section" id="activation-with-learnable-parameter">
<h2>Activation with learnable parameter<a class="headerlink" href="#activation-with-learnable-parameter" title="Permalink to this headline"></a></h2>
<div class="section" id="activation">
<h2>Activation<a class="headerlink" href="#activation" title="Permalink to this headline"></a></h2>
<div class="section" id="prelu">
<h3>prelu<a class="headerlink" href="#prelu" title="Permalink to this headline"></a></h3>
<dl class="class">
......@@ -4478,102 +4562,6 @@ details.</li>
</table>
</dd></dl>
</div>
<div class="section" id="gated-unit">
<h3>gated_unit<a class="headerlink" href="#gated-unit" title="Permalink to this headline"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">gated_unit</code></dt>
<dd><p>The gated unit layer implements a simple gating mechanism over the input.
The input <span class="math">\(X\)</span> is first projected into a new space <span class="math">\(X'\)</span>, and
it is also used to produce a gate weight <span class="math">\(\sigma\)</span>. Element-wise
product between <span class="math">\(X'\)</span> and <span class="math">\(\sigma\)</span> is finally returned.</p>
<dl class="docutils">
<dt>Reference:</dt>
<dd><a class="reference external" href="https://arxiv.org/abs/1612.08083">Language Modeling with Gated Convolutional Networks</a></dd>
</dl>
<div class="math">
\[y=\text{act}(X \cdot W + b)\otimes \sigma(X \cdot V + c)\]</div>
<p>The example usage is:</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>paddle.v2.config_base.Layer</em>) &#8211; The input of this layer.</li>
<li><strong>size</strong> (<em>int</em>) &#8211; The dimension of this layer&#8217;s output.</li>
<li><strong>act</strong> (<em>paddle.v2.activation.Base</em>) &#8211; Activation type of the projection. paddle.v2.activation.Linear is the default
activation.</li>
<li><strong>name</strong> (<em>basestring</em>) &#8211; The name of this layer. It is optional.</li>
<li><strong>gate_attr</strong> (<em>paddle.v2.attr.ExtraAttribute | None</em>) &#8211; The extra layer attribute of the gate. See paddle.v2.attr.ExtraAttribute for
details.</li>
<li><strong>gate_param_attr</strong> (<em>paddle.v2.attr.ParameterAttribute</em>) &#8211; The parameter attribute of the gate. See paddle.v2.attr.ParameterAttribute
for details.</li>
<li><strong>gate_bias_attr</strong> (<em>paddle.v2.attr.ParameterAttribute | bool | None | Any</em>) &#8211; The bias attribute of the gate. If this parameter is set to False or
an object whose type is not paddle.v2.attr.ParameterAttribute, no bias is defined.
If this parameter is set to True, the bias is initialized to zero.</li>
<li><strong>inproj_attr</strong> (<em>paddle.v2.attr.ExtraAttribute | None</em>) &#8211; Extra layer attributes of the projection. See paddle.v2.attr.ExtraAttribute for
details.</li>
<li><strong>inproj_param_attr</strong> (<em>paddle.v2.attr.ParameterAttribute</em>) &#8211; The parameter attribute of the projection. See paddle.v2.attr.ParameterAttribute
for details.</li>
<li><strong>inproj_bias_attr</strong> (<em>paddle.v2.attr.ParameterAttribute | bool | None | Any</em>) &#8211; The bias attribute of the projection. If this parameter is set to False
or an object whose type is not paddle.v2.attr.ParameterAttribute, no bias is defined.
If this parameter is set to True, the bias is initialized to zero.</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttribute | None</em>) &#8211; Extra layer attribute of the product. See paddle.v2.attr.ExtraAttribute for
details.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">paddle.v2.config_base.Layer object.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">paddle.v2.config_base.Layer</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
<div class="section" id="detection-output-layer">
<h2>Detection output Layer<a class="headerlink" href="#detection-output-layer" title="Permalink to this headline"></a></h2>
<div class="section" id="detection-output">
<h3>detection_output<a class="headerlink" href="#detection-output" title="Permalink to this headline"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">detection_output</code></dt>
<dd><p>Apply the NMS to the output of network and compute the predict bounding
box location. The output&#8217;s shape of this layer could be zero if there is
no valid bounding box.</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>name</strong> (<em>basestring</em>) &#8211; The name of this layer. It is optional.</li>
<li><strong>input_loc</strong> (<em>paddle.v2.config_base.Layer | List of paddle.v2.config_base.Layer.</em>) &#8211; The input predict locations.</li>
<li><strong>input_conf</strong> (<em>paddle.v2.config_base.Layer | List of paddle.v2.config_base.Layer.</em>) &#8211; The input priorbox confidence.</li>
<li><strong>priorbox</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; The input priorbox location and the variance.</li>
<li><strong>num_classes</strong> (<em>int</em>) &#8211; The number of the classes.</li>
<li><strong>nms_threshold</strong> (<em>float</em>) &#8211; The Non-maximum suppression threshold.</li>
<li><strong>nms_top_k</strong> (<em>int</em>) &#8211; The bounding boxes number kept of the NMS&#8217;s output.</li>
<li><strong>keep_top_k</strong> (<em>int</em>) &#8211; The bounding boxes number kept of the layer&#8217;s output.</li>
<li><strong>confidence_threshold</strong> (<em>float</em>) &#8211; The classification confidence threshold.</li>
<li><strong>background_id</strong> (<em>int</em>) &#8211; The background class index.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">paddle.v2.config_base.Layer object.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">paddle.v2.config_base.Layer</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
</div>
......
......@@ -729,6 +729,191 @@ sequence.</p>
<dd><p>Converts dataset to recordio format</p>
</dd></dl>
</div>
<div class="section" id="wmt16">
<h2>wmt16<a class="headerlink" href="#wmt16" title="Permalink to this headline"></a></h2>
<p>ACL2016 Multimodal Machine Translation. Please see this website for more
details: <a class="reference external" href="http://www.statmt.org/wmt16/multimodal-task.html#task1">http://www.statmt.org/wmt16/multimodal-task.html#task1</a></p>
<p>If you use the dataset created for your task, please cite the following paper:
Multi30K: Multilingual English-German Image Descriptions.</p>
<dl class="docutils">
<dt>&#64;article{elliott-EtAl:2016:VL16,</dt>
<dd>author = {{Elliott}, D. and {Frank}, S. and {Sima&#8221;an}, K. and {Specia}, L.},
title = {Multi30K: Multilingual English-German Image Descriptions},
booktitle = {Proceedings of the 6th Workshop on Vision and Language},
year = {2016},
pages = {70&#8211;74},
year = 2016</dd>
</dl>
<p>}</p>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.dataset.wmt16.</code><code class="descname">train</code><span class="sig-paren">(</span><em>src_dict_size</em>, <em>trg_dict_size</em>, <em>src_lang='en'</em><span class="sig-paren">)</span></dt>
<dd><p>WMT16 train set reader.</p>
<p>This function returns the reader for train data. Each sample the reader
returns is made up of three fields: the source language word index sequence,
target language word index sequence and next word index sequence.</p>
<p>NOTE:
The original like for training data is:
<a class="reference external" href="http://www.quest.dcs.shef.ac.uk/wmt16_files_mmt/training.tar.gz">http://www.quest.dcs.shef.ac.uk/wmt16_files_mmt/training.tar.gz</a></p>
<p>paddle.dataset.wmt16 provides a tokenized version of the original dataset by
using moses&#8217;s tokenization script:
<a class="reference external" href="https://github.com/moses-smt/mosesdecoder/blob/master/scripts/tokenizer/tokenizer.perl">https://github.com/moses-smt/mosesdecoder/blob/master/scripts/tokenizer/tokenizer.perl</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>src_dict_size</strong> (<em>int</em>) &#8211; Size of the source language dictionary. Three
special tokens will be added into the dictionary:
&lt;s&gt; for start mark, &lt;e&gt; for end mark, and &lt;unk&gt; for
unknown word.</li>
<li><strong>trg_dict_size</strong> (<em>int</em>) &#8211; Size of the target language dictionary. Three
special tokens will be added into the dictionary:
&lt;s&gt; for start mark, &lt;e&gt; for end mark, and &lt;unk&gt; for
unknown word.</li>
<li><strong>src_lang</strong> (<em>string</em>) &#8211; A string indicating which language is the source
language. Available options are: &#8220;en&#8221; for English
and &#8220;de&#8221; for Germany.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The train reader.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">callable</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.dataset.wmt16.</code><code class="descname">test</code><span class="sig-paren">(</span><em>src_dict_size</em>, <em>trg_dict_size</em>, <em>src_lang='en'</em><span class="sig-paren">)</span></dt>
<dd><p>WMT16 test set reader.</p>
<p>This function returns the reader for test data. Each sample the reader
returns is made up of three fields: the source language word index sequence,
target language word index sequence and next word index sequence.</p>
<p>NOTE:
The original like for test data is:
<a class="reference external" href="http://www.quest.dcs.shef.ac.uk/wmt16_files_mmt/mmt16_task1_test.tar.gz">http://www.quest.dcs.shef.ac.uk/wmt16_files_mmt/mmt16_task1_test.tar.gz</a></p>
<p>paddle.dataset.wmt16 provides a tokenized version of the original dataset by
using moses&#8217;s tokenization script:
<a class="reference external" href="https://github.com/moses-smt/mosesdecoder/blob/master/scripts/tokenizer/tokenizer.perl">https://github.com/moses-smt/mosesdecoder/blob/master/scripts/tokenizer/tokenizer.perl</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>src_dict_size</strong> (<em>int</em>) &#8211; Size of the source language dictionary. Three
special tokens will be added into the dictionary:
&lt;s&gt; for start mark, &lt;e&gt; for end mark, and &lt;unk&gt; for
unknown word.</li>
<li><strong>trg_dict_size</strong> (<em>int</em>) &#8211; Size of the target language dictionary. Three
special tokens will be added into the dictionary:
&lt;s&gt; for start mark, &lt;e&gt; for end mark, and &lt;unk&gt; for
unknown word.</li>
<li><strong>src_lang</strong> (<em>string</em>) &#8211; A string indicating which language is the source
language. Available options are: &#8220;en&#8221; for English
and &#8220;de&#8221; for Germany.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The test reader.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">callable</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.dataset.wmt16.</code><code class="descname">validation</code><span class="sig-paren">(</span><em>src_dict_size</em>, <em>trg_dict_size</em>, <em>src_lang='en'</em><span class="sig-paren">)</span></dt>
<dd><p>WMT16 validation set reader.</p>
<p>This function returns the reader for validation data. Each sample the reader
returns is made up of three fields: the source language word index sequence,
target language word index sequence and next word index sequence.</p>
<p>NOTE:
The original like for validation data is:
<a class="reference external" href="http://www.quest.dcs.shef.ac.uk/wmt16_files_mmt/validation.tar.gz">http://www.quest.dcs.shef.ac.uk/wmt16_files_mmt/validation.tar.gz</a></p>
<p>paddle.dataset.wmt16 provides a tokenized version of the original dataset by
using moses&#8217;s tokenization script:
<a class="reference external" href="https://github.com/moses-smt/mosesdecoder/blob/master/scripts/tokenizer/tokenizer.perl">https://github.com/moses-smt/mosesdecoder/blob/master/scripts/tokenizer/tokenizer.perl</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>src_dict_size</strong> (<em>int</em>) &#8211; Size of the source language dictionary. Three
special tokens will be added into the dictionary:
&lt;s&gt; for start mark, &lt;e&gt; for end mark, and &lt;unk&gt; for
unknown word.</li>
<li><strong>trg_dict_size</strong> (<em>int</em>) &#8211; Size of the target language dictionary. Three
special tokens will be added into the dictionary:
&lt;s&gt; for start mark, &lt;e&gt; for end mark, and &lt;unk&gt; for
unknown word.</li>
<li><strong>src_lang</strong> (<em>string</em>) &#8211; A string indicating which language is the source
language. Available options are: &#8220;en&#8221; for English
and &#8220;de&#8221; for Germany.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The validation reader.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">callable</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.dataset.wmt16.</code><code class="descname">get_dict</code><span class="sig-paren">(</span><em>lang</em>, <em>dict_size</em>, <em>reverse=False</em><span class="sig-paren">)</span></dt>
<dd><p>return the word dictionary for the specified language.</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>lang</strong> (<em>string</em>) &#8211; A string indicating which language is the source
language. Available options are: &#8220;en&#8221; for English
and &#8220;de&#8221; for Germany.</li>
<li><strong>dict_size</strong> (<em>int</em>) &#8211; Size of the specified language dictionary.</li>
<li><strong>reverse</strong> (<em>bool</em>) &#8211; If reverse is set to False, the returned python
dictionary will use word as key and use index as value.
If reverse is set to True, the returned python
dictionary will use index as key and word as value.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The word dictionary for the specific language.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">dict</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.dataset.wmt16.</code><code class="descname">fetch</code><span class="sig-paren">(</span><span class="sig-paren">)</span></dt>
<dd><p>download the entire dataset.</p>
</dd></dl>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.dataset.wmt16.</code><code class="descname">convert</code><span class="sig-paren">(</span><em>path</em>, <em>src_dict_size</em>, <em>trg_dict_size</em>, <em>src_lang</em><span class="sig-paren">)</span></dt>
<dd><p>Converts dataset to recordio format.</p>
</dd></dl>
</div>
</div>
......
......@@ -1501,6 +1501,107 @@
"comment" : "(int, default 1), The mul_op can take tensors with more than two,\n dimensions as its inputs. If the input $Y$ is a tensor with more\n than two dimensions, $Y$ will be flattened into a two-dimensional\n matrix first. The attribute `y_num_col_dims` determines how $Y$ is\n flattened. See comments of `x_num_col_dims` for more details.\n ",
"generated" : 0
} ]
},{
"type" : "mine_hard_examples",
"comment" : "\nMine hard examples Operator.\nThis operator implements hard example mining to select a subset of negative box indices.\nFor each image, selects the box with highest losses. subject to the condition that the \nbox cannot have an Matcht > neg_dist_threshold when mining_type is max_negative. \nThe selected number is min(sample_size, max_negative_box_number) when mining_type is \nhard_example, or min(neg_pos_ratio * positive_box_number, max_negative_box_number) \nwhen mining_type is max_negative, where the max_negative_box_number is the count of \nMatchIndices elements with value -1.\n",
"inputs" : [
{
"name" : "ClsLoss",
"comment" : "(Tensor, default Tensor<float>), The classification loss with shape [N, Np], N is the batch size and Np is the number of prior box.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "LocLoss",
"comment" : "(Tensor, optional, default Tensor<float>), The localization loss with shape [N, Np], N is the batch size and Np is the number of prior box.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "MatchIndices",
"comment" : "(Tensor, Tensor<int>), Matched indices with shape [N, Np], N is the batch size and Np is the number of prior box. MatchIndices[i][j] equal -1 means the j-th prior box in i-th instance does not match any entity, otherwise means it is matched to row.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "MatchDist",
"comment" : "(Tensor, default Tensor<float>) Matched indices with shape [N, Np], N is the batch size and Np is the number of prior box.",
"duplicable" : 0,
"intermediate" : 0
} ],
"outputs" : [
{
"name" : "NegIndices",
"comment" : "(LoDTensor<int>) The output of negative example indices. a LoDTensor with shape [Neg, 1]. The size of lod[0] minus 1 is batch size, and each element is the prior box index. For example, the batch size is 2, the lod is [[0, 1, 2]], the sample 0's box 1(MatchIndices[0][1]) is selected, and sample 1's box 0 is selected. The output NegIndices is [[1], [0]].",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "UpdatedMatchIndices",
"comment" : "(Tensor<int>) The output of updated MatchIndices, a tensor with shape [N, Np]. Only update when mining_type is hard_example. The input MatchIndices elements will be update to -1 when it is not in the candidate high loss list of negative examples.",
"duplicable" : 0,
"intermediate" : 0
} ],
"attrs" : [
{
"name" : "neg_pos_ratio",
"type" : "float",
"comment" : "(float) The ratio of the negative box to the positive box. Use only when mining_type is max_negative.",
"generated" : 0
}, {
"name" : "neg_dist_threshold",
"type" : "float",
"comment" : "(float) The negative overlap upper bound for the unmatched predictions. Use only when mining_type is max_negative.",
"generated" : 0
}, {
"name" : "sample_size",
"type" : "int",
"comment" : "(float) The max sample size of negative box. Use only when mining_type is hard_example.",
"generated" : 0
}, {
"name" : "mining_type",
"type" : "string",
"comment" : "(float) The mining algorithm name, the value is hard_example or max_negative.",
"generated" : 0
} ]
},{
"type" : "swish",
"comment" : "\nSwish Activation Operator.\n\n$$out = \\frac{x}{1 + e^{- \\beta x}}$$\n\n",
"inputs" : [
{
"name" : "X",
"comment" : "Input of Swish operator",
"duplicable" : 0,
"intermediate" : 0
} ],
"outputs" : [
{
"name" : "Out",
"comment" : "Output of Swish operator",
"duplicable" : 0,
"intermediate" : 0
} ],
"attrs" : [
{
"name" : "beta",
"type" : "float",
"comment" : "Constant beta of swish operator",
"generated" : 0
} ]
},{
"type" : "is_empty",
"comment" : "\nIsEmpty Operator which checks whether a tensor is empty.\n\nIt will just return product(tensor.ddims()) > 0;\n ",
"inputs" : [
{
"name" : "X",
"comment" : "(Tensor) Tensor which is to be checked.",
"duplicable" : 0,
"intermediate" : 0
} ],
"outputs" : [
{
"name" : "Out",
"comment" : "(Tensor) a boolean Tensor that indicate empty or not.",
"duplicable" : 0,
"intermediate" : 0
} ],
"attrs" : [ ]
},{
"type" : "minus",
"comment" : "\nMinus Operator.\n\nEquation:\n\n $Out = X - Y$\n\nBoth the input `X` and `Y` can carry the LoD (Level of Details) information,\nor not. But the output only shares the LoD information with input `X`.\n\n",
......@@ -2377,29 +2478,6 @@
"comment" : "(int, default 5(FP32)) Output tensor data type",
"generated" : 0
} ]
},{
"type" : "logical_xor",
"comment" : "logical_xor Operator\n\nIt operates element-wise on X and Y, and returns the Out. X, Y and Out are N-dim boolean tensors.\nEach element of Out is calculated by $$Out = (X || Y) \\, \\&\\& \\, !(X \\&\\& Y)$$\n",
"inputs" : [
{
"name" : "X",
"comment" : "(LoDTensor) Left hand operand of logical_xor operator",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "Y",
"comment" : "(LoDTensor) Right hand operand of logical_xor operator",
"duplicable" : 0,
"intermediate" : 0
} ],
"outputs" : [
{
"name" : "Out",
"comment" : "(LoDTensor) n-dim bool tensor. Each element is $$Out = (X || Y) \\, \\&\\& \\, !(X \\&\\& Y)$$",
"duplicable" : 0,
"intermediate" : 0
} ],
"attrs" : [ ]
},{
"type" : "pad",
"comment" : "\nPad Operator.\n\nPad input into output, as specified by paddings and pad_value. \nThe input should be a k-D tensor(k > 0 and k < 7). As an example:\n\nGiven:\n\nX = [[1, 2],\n [3, 4]],\n\npaddings = [0, 1, 1, 2],\n\nand\n\npad_value = 0,\n\nwe have:\n\nOut = [[0, 1, 2, 0, 0]\n [0, 3, 4, 0, 0]\n [0, 0, 0, 0, 0]]\n\n",
......@@ -3703,6 +3781,29 @@
"intermediate" : 0
} ],
"attrs" : [ ]
},{
"type" : "logical_xor",
"comment" : "logical_xor Operator\n\nIt operates element-wise on X and Y, and returns the Out. X, Y and Out are N-dim boolean tensors.\nEach element of Out is calculated by $$Out = (X || Y) \\, \\&\\& \\, !(X \\&\\& Y)$$\n",
"inputs" : [
{
"name" : "X",
"comment" : "(LoDTensor) Left hand operand of logical_xor operator",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "Y",
"comment" : "(LoDTensor) Right hand operand of logical_xor operator",
"duplicable" : 0,
"intermediate" : 0
} ],
"outputs" : [
{
"name" : "Out",
"comment" : "(LoDTensor) n-dim bool tensor. Each element is $$Out = (X || Y) \\, \\&\\& \\, !(X \\&\\& Y)$$",
"duplicable" : 0,
"intermediate" : 0
} ],
"attrs" : [ ]
},{
"type" : "log_loss",
"comment" : "\nLogLoss Operator.\n\nLog loss is a loss function used for binary classification. Log Loss quantifies\nthe accuracy of a classifier by penalising false classifications. Minimising the\nLog Loss is equivalent to maximising the accuracy of the classifier. We define\nPredicted as the values predicted by our model and Labels as the target ground\ntruth value. Log loss can evaluate how close the predicted values are to the\ntarget. The shapes of Predicted and Labels are both [batch_size, 1].\nThe equation is:\n\n$$\nLoss = - Labels * log(Predicted + \\epsilon) -\n (1 - Labels) * log(1 - Predicted + \\epsilon)\n$$\n\n",
......@@ -4018,48 +4119,6 @@
"intermediate" : 0
} ],
"attrs" : [ ]
},{
"type" : "swish",
"comment" : "\nSwish Activation Operator.\n\n$$out = \\frac{x}{1 + e^{- \\beta x}}$$\n\n",
"inputs" : [
{
"name" : "X",
"comment" : "Input of Swish operator",
"duplicable" : 0,
"intermediate" : 0
} ],
"outputs" : [
{
"name" : "Out",
"comment" : "Output of Swish operator",
"duplicable" : 0,
"intermediate" : 0
} ],
"attrs" : [
{
"name" : "beta",
"type" : "float",
"comment" : "Constant beta of swish operator",
"generated" : 0
} ]
},{
"type" : "is_empty",
"comment" : "\nIsEmpty Operator which checks whether a tensor is empty.\n\nIt will just return product(tensor.ddims()) > 0;\n ",
"inputs" : [
{
"name" : "X",
"comment" : "(Tensor) Tensor which is to be checked.",
"duplicable" : 0,
"intermediate" : 0
} ],
"outputs" : [
{
"name" : "Out",
"comment" : "(Tensor) a boolean Tensor that indicate empty or not.",
"duplicable" : 0,
"intermediate" : 0
} ],
"attrs" : [ ]
},{
"type" : "iou_similarity",
"comment" : "\nIOU Similarity Operator.\nComputes intersection-over-union (IOU) between two box lists.\n Box list 'X' should be a LoDTensor and 'Y' is a common Tensor,\n boxes in 'Y' are shared by all instance of the batched inputs of X.\n Given two boxes A and B, the calculation of IOU is as follows:\n\n$$\nIOU(A, B) = \n\\frac{area(A\\cap B)}{area(A)+area(B)-area(A\\cap B)}\n$$\n\n",
......@@ -5416,70 +5475,6 @@
"comment" : "(float) The maximum norm value.",
"generated" : 0
} ]
},{
"type" : "chunk_eval",
"comment" : "\nFor some basics of chunking, please refer to\n‘Chunking with Support Vector Machines <https://aclanthology.info/pdf/N/N01/N01-1025.pdf>’.\n\n\nCheckEvalOp computes the precision, recall, and F1-score of chunk detection,\nand supports IOB, IOE, IOBES and IO (also known as plain) tagging schemes.\nHere is a NER example of labeling for these tagging schemes:\n\n \t Li Ming works at Agricultural Bank of China in Beijing.\n IO: I-PER I-PER O O I-ORG I-ORG I-ORG I-ORG O I-LOC\n IOB: B-PER I-PER O O B-ORG I-ORG I-ORG I-ORG O B-LOC\n IOE: I-PER E-PER O O I-ORG I-ORG I-ORG E-ORG O E-LOC\n IOBES: B-PER E-PER O O I-ORG I-ORG I-ORG E-ORG O S-LOC\n\nThere are three chunk types(named entity types) including PER(person), ORG(organization)\nand LOC(LOCATION), and we can see that the labels have the form <tag type>-<chunk type>.\n\nSince the calculations actually use label ids rather than labels, extra attention\nshould be paid when mapping labels to ids to make CheckEvalOp work. The key point\nis that the listed equations are satisfied by ids.\n\n tag_type = label % num_tag_type\n chunk_type = label / num_tag_type\n\nwhere `num_tag_type` is the num of tag types in the tagging scheme, `num_chunk_type`\nis the num of chunk types, and `tag_type` get its value from the following table.\n\n Scheme Begin Inside End Single\n plain 0 - - -\n IOB 0 1 - -\n IOE - 0 1 -\n IOBES 0 1 2 3\n\nStill use NER as example, assuming the tagging scheme is IOB while chunk types are ORG,\nPER and LOC. To satisfy the above equations, the label map can be like this:\n\n B-ORG 0\n I-ORG 1\n B-PER 2\n I-PER 3\n B-LOC 4\n I-LOC 5\n O 6\n\nIt’s not hard to verify the equations noting that the num of chunk types\nis 3 and the num of tag types in IOB scheme is 2. For example, the label\nid of I-LOC is 5, the tag type id of I-LOC is 1, and the chunk type id of\nI-LOC is 2, which consistent with the results from the equations.\n",
"inputs" : [
{
"name" : "Inference",
"comment" : "(Tensor, default: Tensor<int64_t>). Predictions from the network.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "Label",
"comment" : "(Tensor, default: Tensor<int64_t>). The true tag sequences.",
"duplicable" : 0,
"intermediate" : 0
} ],
"outputs" : [
{
"name" : "Precision",
"comment" : "(float). The evaluated precision (called positive predictive value) of chunks on the given mini-batch.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "Recall",
"comment" : "(float). The evaluated recall (true positive rate or sensitivity) of chunks on the given mini-batch.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "F1-Score",
"comment" : "(float). The evaluated F1-Score on the given mini-batch.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "NumInferChunks",
"comment" : "(int64_t). The number of chunks in Inference on the given mini-batch.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "NumLabelChunks",
"comment" : "(int64_t). The number of chunks in Label on the given mini-batch.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "NumCorrectChunks",
"comment" : "(int64_t). The number of chunks both in Inference and Label on the given mini-batch.",
"duplicable" : 0,
"intermediate" : 0
} ],
"attrs" : [
{
"name" : "num_chunk_types",
"type" : "int",
"comment" : "(int). The number of chunk type. See below for details.",
"generated" : 0
}, {
"name" : "chunk_scheme",
"type" : "string",
"comment" : "(string, default IOB). The labeling scheme indicating how to encode the chunks. Must be IOB, IOE, IOBES or plain. See below for details.",
"generated" : 0
}, {
"name" : "excluded_chunk_types",
"type" : "int array",
"comment" : "(list<int>) A list including chunk type ids indicating chunk types that are not counted. See below for details.",
"generated" : 0
} ]
},{
"type" : "sigmoid",
"comment" : "\nSigmoid Activation Operator\n\n$$out = \\frac{1}{1 + e^{-x}}$$\n\n",
......@@ -5574,6 +5569,104 @@
"comment" : "input data type",
"generated" : 0
} ]
},{
"type" : "chunk_eval",
"comment" : "\nFor some basics of chunking, please refer to\n‘Chunking with Support Vector Machines <https://aclanthology.info/pdf/N/N01/N01-1025.pdf>’.\n\n\nCheckEvalOp computes the precision, recall, and F1-score of chunk detection,\nand supports IOB, IOE, IOBES and IO (also known as plain) tagging schemes.\nHere is a NER example of labeling for these tagging schemes:\n\n \t Li Ming works at Agricultural Bank of China in Beijing.\n IO: I-PER I-PER O O I-ORG I-ORG I-ORG I-ORG O I-LOC\n IOB: B-PER I-PER O O B-ORG I-ORG I-ORG I-ORG O B-LOC\n IOE: I-PER E-PER O O I-ORG I-ORG I-ORG E-ORG O E-LOC\n IOBES: B-PER E-PER O O I-ORG I-ORG I-ORG E-ORG O S-LOC\n\nThere are three chunk types(named entity types) including PER(person), ORG(organization)\nand LOC(LOCATION), and we can see that the labels have the form <tag type>-<chunk type>.\n\nSince the calculations actually use label ids rather than labels, extra attention\nshould be paid when mapping labels to ids to make CheckEvalOp work. The key point\nis that the listed equations are satisfied by ids.\n\n tag_type = label % num_tag_type\n chunk_type = label / num_tag_type\n\nwhere `num_tag_type` is the num of tag types in the tagging scheme, `num_chunk_type`\nis the num of chunk types, and `tag_type` get its value from the following table.\n\n Scheme Begin Inside End Single\n plain 0 - - -\n IOB 0 1 - -\n IOE - 0 1 -\n IOBES 0 1 2 3\n\nStill use NER as example, assuming the tagging scheme is IOB while chunk types are ORG,\nPER and LOC. To satisfy the above equations, the label map can be like this:\n\n B-ORG 0\n I-ORG 1\n B-PER 2\n I-PER 3\n B-LOC 4\n I-LOC 5\n O 6\n\nIt’s not hard to verify the equations noting that the num of chunk types\nis 3 and the num of tag types in IOB scheme is 2. For example, the label\nid of I-LOC is 5, the tag type id of I-LOC is 1, and the chunk type id of\nI-LOC is 2, which consistent with the results from the equations.\n",
"inputs" : [
{
"name" : "Inference",
"comment" : "(Tensor, default: Tensor<int64_t>). Predictions from the network.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "Label",
"comment" : "(Tensor, default: Tensor<int64_t>). The true tag sequences.",
"duplicable" : 0,
"intermediate" : 0
} ],
"outputs" : [
{
"name" : "Precision",
"comment" : "(float). The evaluated precision (called positive predictive value) of chunks on the given mini-batch.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "Recall",
"comment" : "(float). The evaluated recall (true positive rate or sensitivity) of chunks on the given mini-batch.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "F1-Score",
"comment" : "(float). The evaluated F1-Score on the given mini-batch.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "NumInferChunks",
"comment" : "(int64_t). The number of chunks in Inference on the given mini-batch.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "NumLabelChunks",
"comment" : "(int64_t). The number of chunks in Label on the given mini-batch.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "NumCorrectChunks",
"comment" : "(int64_t). The number of chunks both in Inference and Label on the given mini-batch.",
"duplicable" : 0,
"intermediate" : 0
} ],
"attrs" : [
{
"name" : "num_chunk_types",
"type" : "int",
"comment" : "(int). The number of chunk type. See below for details.",
"generated" : 0
}, {
"name" : "chunk_scheme",
"type" : "string",
"comment" : "(string, default IOB). The labeling scheme indicating how to encode the chunks. Must be IOB, IOE, IOBES or plain. See below for details.",
"generated" : 0
}, {
"name" : "excluded_chunk_types",
"type" : "int array",
"comment" : "(list<int>) A list including chunk type ids indicating chunk types that are not counted. See below for details.",
"generated" : 0
} ]
},{
"type" : "box_coder",
"comment" : "\nBounding Box Coder Operator.\nEncode/Decode the target bounding box with the priorbox information.\nThe Encoding schema described below:\nox = (tx - px) / pw / pxv\noy = (ty - py) / ph / pyv\now = log(abs(tw / pw)) / pwv \noh = log(abs(th / ph)) / phv \nThe Decoding schema described below:\nox = (pw * pxv * tx * + px) - tw / 2\noy = (ph * pyv * ty * + py) - th / 2\now = exp(pwv * tw) * pw + tw / 2\noh = exp(phv * th) * ph + th / 2\nwhere tx, ty, tw, th denote the target box's center coordinates, width and\nheight respectively. Similarly, px, py, pw, ph denote the priorbox's(anchor)\ncenter coordinates, width and height. pxv, pyv, pwv, phv denote the variance\nof the priorbox and ox, oy, ow, oh denote the encoded/decoded coordinates,\nwidth and height.\n",
"inputs" : [
{
"name" : "PriorBox",
"comment" : "(Tensor, default Tensor<float>) Box list PriorBox is a 2-D Tensor with shape [M, 4] holds M boxes, each box is represented as [xmin, ymin, xmax, ymax], [xmin, ymin] is the left top coordinate of the anchor box, if the input is image feature map, they are close to the origin of the coordinate system. [xmax, ymax] is the right bottom coordinate of the anchor box.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "PriorBoxVar",
"comment" : "(Tensor, default Tensor<float>) PriorBoxVar is a 2-D Tensor with shape [M, 4] holds M group of variance.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "TargetBox",
"comment" : "(LoDTensor or Tensor) this input is a 2-D LoDTensor with shape [N, 4], each box is represented as [xmin, ymin, xmax, ymax], [xmin, ymin] is the left top coordinate of the box if the input is image feature map, they are close to the origin of the coordinate system. [xmax, ymax] is the right bottom coordinate of the box. This tensor can contain LoD information to represent a batch of inputs. One instance of this batch can contain different numbers of entities.",
"duplicable" : 0,
"intermediate" : 0
} ],
"outputs" : [
{
"name" : "OutputBox",
"comment" : "(LoDTensor or Tensor) (Tensor) The output of box_coder_op, a tensor with shape [N, M, 4] representing the result of N target boxes encoded/decoded with M Prior boxes and variances.",
"duplicable" : 0,
"intermediate" : 0
} ],
"attrs" : [
{
"name" : "code_type",
"type" : "string",
"comment" : "(string, default encode_center_size) the code type used with the target box",
"generated" : 0
} ]
},{
"type" : "bipartite_match",
"comment" : "\nThis operator is a greedy bipartite matching algorithm, which is used to\nobtain the matching with the maximum distance based on the input\ndistance matrix. For input 2D matrix, the bipartite matching algorithm can\nfind the matched column for each row, also can find the matched row for\neach column. And this operator only calculate matched indices from column\nto row. For each instance, the number of matched indices is the number of\nof columns of the input ditance matrix.\n\nThere are two outputs to save matched indices and distance.\nA simple description, this algothrim matched the best (maximum distance)\nrow entity to the column entity and the matched indices are not duplicated\nin each row of ColToRowMatchIndices. If the column entity is not matched\nany row entity, set -1 in ColToRowMatchIndices.\n\nPlease note that the input DistMat can be LoDTensor (with LoD) or Tensor.\nIf LoDTensor with LoD, the height of ColToRowMatchIndices is batch size.\nIf Tensor, the height of ColToRowMatchIndices is 1.\n\n",
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -87,6 +87,11 @@ roi_pool
.. autoclass:: paddle.v2.layer.roi_pool
:noindex:
pad
----
.. autoclass:: paddle.v2.layer.pad
:noindex:
Norm Layer
==========
......@@ -133,6 +138,11 @@ grumemory
.. autoclass:: paddle.v2.layer.grumemory
:noindex:
gated_unit
-----------
.. autoclass:: paddle.v2.layer.gated_unit
:noindex:
Recurrent Layer Group
=====================
......@@ -340,6 +350,11 @@ bilinear_interp
.. autoclass:: paddle.v2.layer.bilinear_interp
:noindex:
dropout
--------
.. autoclass:: paddle.v2.layer.dropout
:noindex:
dot_prod
---------
.. autoclass:: paddle.v2.layer.dot_prod
......@@ -402,6 +417,11 @@ scale_shift
.. autoclass:: paddle.v2.layer.scale_shift
:noindex:
factorization_machine
---------------------
.. autoclass:: paddle.v2.layer.factorization_machine
:noindex:
Sampling Layers
===============
......@@ -420,22 +440,6 @@ multiplex
.. autoclass:: paddle.v2.layer.multiplex
:noindex:
Factorization Machine Layer
============================
factorization_machine
---------------------
.. autoclass:: paddle.v2.layer.factorization_machine
:noindex:
Slicing and Joining Layers
==========================
pad
----
.. autoclass:: paddle.v2.layer.pad
:noindex:
.. _api_v2.layer_costs:
Cost Layers
......@@ -526,6 +530,11 @@ multibox_loss
.. autoclass:: paddle.v2.layer.multibox_loss
:noindex:
detection_output
----------------
.. autoclass:: paddle.v2.layer.detection_output
:noindex:
Check Layer
============
......@@ -534,31 +543,10 @@ eos
.. autoclass:: paddle.v2.layer.eos
:noindex:
Miscs
=====
dropout
--------
.. autoclass:: paddle.v2.layer.dropout
:noindex:
Activation with learnable parameter
===================================
Activation
==========
prelu
--------
.. autoclass:: paddle.v2.layer.prelu
:noindex:
gated_unit
-----------
.. autoclass:: paddle.v2.layer.gated_unit
:noindex:
Detection output Layer
======================
detection_output
----------------
.. autoclass:: paddle.v2.layer.detection_output
:noindex:
......@@ -73,3 +73,10 @@ wmt14
.. automodule:: paddle.v2.dataset.wmt14
:members:
:noindex:
wmt16
+++++
.. automodule:: paddle.v2.dataset.wmt16
:members:
:noindex:
......@@ -930,6 +930,73 @@ feature map.</p>
</table>
</dd></dl>
</div>
<div class="section" id="pad">
<h3>pad<a class="headerlink" href="#pad" title="永久链接至标题"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">pad</code></dt>
<dd><p>This operation pads zeros to the input data according to pad_c,pad_h
and pad_w. pad_c, pad_h, pad_w specify the size in the corresponding
dimension. And the input data shape is NCHW.</p>
<p>For example, pad_c=[2,3] means padding 2 zeros before the input data
and 3 zeros after the input data in the channel dimension. pad_h means
padding zeros in the height dimension. pad_w means padding zeros in the
width dimension.</p>
<p>For example,</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="nb">input</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</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="o">=</span> <span class="p">[</span>
<span class="p">[</span> <span class="p">[[</span><span class="mi">1</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="p">[</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">]],</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">5</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span><span class="mi">7</span><span class="p">]]</span> <span class="p">],</span>
<span class="p">[</span> <span class="p">[[</span><span class="mi">4</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">7</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">3</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">9</span><span class="p">],</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">5</span><span class="p">]]</span> <span class="p">]</span>
<span class="p">]</span>
<span class="n">pad_c</span><span class="o">=</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span> <span class="n">pad_h</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="n">pad_w</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]</span>
<span class="n">output</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">4</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="o">=</span> <span class="p">[</span>
<span class="p">[</span> <span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">1</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="p">[</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">]],</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">5</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span><span class="mi">7</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]]</span> <span class="p">],</span>
<span class="p">[</span> <span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">4</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">7</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">3</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">9</span><span class="p">],</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">5</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]]</span> <span class="p">]</span>
<span class="p">]</span>
</pre></div>
</div>
<p>The simply usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">pad</span> <span class="o">=</span> <span class="n">pad</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="n">ipt</span><span class="p">,</span>
<span class="n">pad_c</span><span class="o">=</span><span class="p">[</span><span class="mi">4</span><span class="p">,</span><span class="mi">4</span><span class="p">],</span>
<span class="n">pad_h</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span>
<span class="n">pad_w</span><span class="o">=</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">])</span>
</pre></div>
</div>
<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>paddle.v2.config_base.Layer</em>) &#8211; The input of this layer.</li>
<li><strong>pad_c</strong> (<em>list | None</em>) &#8211; The padding size in the channel dimension.</li>
<li><strong>pad_h</strong> (<em>list | None</em>) &#8211; The padding size in the height dimension.</li>
<li><strong>pad_w</strong> (<em>list | None</em>) &#8211; The padding size in the width dimension.</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttribute</em>) &#8211; The extra layer attribute. See paddle.v2.attr.ExtraAttribute for
details.</li>
<li><strong>name</strong> (<em>basestring</em>) &#8211; The name of this layer. It is optional.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">paddle.v2.config_base.Layer object.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">paddle.v2.config_base.Layer</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
<div class="section" id="norm-layer">
......@@ -1335,6 +1402,62 @@ details.</li>
</table>
</dd></dl>
</div>
<div class="section" id="gated-unit">
<h3>gated_unit<a class="headerlink" href="#gated-unit" title="永久链接至标题"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">gated_unit</code></dt>
<dd><p>The gated unit layer implements a simple gating mechanism over the input.
The input <span class="math">\(X\)</span> is first projected into a new space <span class="math">\(X'\)</span>, and
it is also used to produce a gate weight <span class="math">\(\sigma\)</span>. Element-wise
product between <span class="math">\(X'\)</span> and <span class="math">\(\sigma\)</span> is finally returned.</p>
<dl class="docutils">
<dt>Reference:</dt>
<dd><a class="reference external" href="https://arxiv.org/abs/1612.08083">Language Modeling with Gated Convolutional Networks</a></dd>
</dl>
<div class="math">
\[y=\text{act}(X \cdot W + b)\otimes \sigma(X \cdot V + c)\]</div>
<p>The example usage is:</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>paddle.v2.config_base.Layer</em>) &#8211; The input of this layer.</li>
<li><strong>size</strong> (<em>int</em>) &#8211; The dimension of this layer&#8217;s output.</li>
<li><strong>act</strong> (<em>paddle.v2.activation.Base</em>) &#8211; Activation type of the projection. paddle.v2.activation.Linear is the default
activation.</li>
<li><strong>name</strong> (<em>basestring</em>) &#8211; The name of this layer. It is optional.</li>
<li><strong>gate_attr</strong> (<em>paddle.v2.attr.ExtraAttribute | None</em>) &#8211; The extra layer attribute of the gate. See paddle.v2.attr.ExtraAttribute for
details.</li>
<li><strong>gate_param_attr</strong> (<em>paddle.v2.attr.ParameterAttribute</em>) &#8211; The parameter attribute of the gate. See paddle.v2.attr.ParameterAttribute
for details.</li>
<li><strong>gate_bias_attr</strong> (<em>paddle.v2.attr.ParameterAttribute | bool | None | Any</em>) &#8211; The bias attribute of the gate. If this parameter is set to False or
an object whose type is not paddle.v2.attr.ParameterAttribute, no bias is defined.
If this parameter is set to True, the bias is initialized to zero.</li>
<li><strong>inproj_attr</strong> (<em>paddle.v2.attr.ExtraAttribute | None</em>) &#8211; Extra layer attributes of the projection. See paddle.v2.attr.ExtraAttribute for
details.</li>
<li><strong>inproj_param_attr</strong> (<em>paddle.v2.attr.ParameterAttribute</em>) &#8211; The parameter attribute of the projection. See paddle.v2.attr.ParameterAttribute
for details.</li>
<li><strong>inproj_bias_attr</strong> (<em>paddle.v2.attr.ParameterAttribute | bool | None | Any</em>) &#8211; The bias attribute of the projection. If this parameter is set to False
or an object whose type is not paddle.v2.attr.ParameterAttribute, no bias is defined.
If this parameter is set to True, the bias is initialized to zero.</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttribute | None</em>) &#8211; Extra layer attribute of the product. See paddle.v2.attr.ExtraAttribute for
details.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">paddle.v2.config_base.Layer object.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">paddle.v2.config_base.Layer</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
<div class="section" id="recurrent-layer-group">
......@@ -2895,6 +3018,37 @@ details.</li>
</table>
</dd></dl>
</div>
<div class="section" id="dropout">
<h3>dropout<a class="headerlink" href="#dropout" title="永久链接至标题"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">dropout</code></dt>
<dd><p>The example usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">dropout</span> <span class="o">=</span> <span class="n">dropout</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="nb">input</span><span class="p">,</span> <span class="n">dropout_rate</span><span class="o">=</span><span class="mf">0.5</span><span class="p">)</span>
</pre></div>
</div>
<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>name</strong> (<em>basestring</em>) &#8211; The name of this layer. It is optional.</li>
<li><strong>input</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; The input of this layer.</li>
<li><strong>dropout_rate</strong> (<em>float</em>) &#8211; The probability of dropout.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">paddle.v2.config_base.Layer object.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">paddle.v2.config_base.Layer</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="dot-prod">
<h3>dot_prod<a class="headerlink" href="#dot-prod" title="永久链接至标题"></a></h3>
......@@ -3363,6 +3517,54 @@ parameter is set to True, the bias is initialized to zero.</li>
</table>
</dd></dl>
</div>
<div class="section" id="factorization-machine">
<h3>factorization_machine<a class="headerlink" href="#factorization-machine" title="永久链接至标题"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">factorization_machine</code></dt>
<dd><p>The Factorization Machine models pairwise feature interactions as inner
product of the learned latent vectors corresponding to each input feature.
The Factorization Machine can effectively capture feature interactions
especially when the input is sparse.</p>
<p>This implementation only consider the 2-order feature interactions using
Factorization Machine with the formula:</p>
<div class="math">
\[y = \sum_{i=1}^{n-1}\sum_{j=i+1}^n\langle v_i, v_j \rangle x_i x_j\]</div>
<div class="admonition note">
<p class="first admonition-title">注解</p>
<p class="last">X is the input vector with size n. V is the factor matrix. Each row of V
is the latent vector corresponding to each input dimesion. The size of
each latent vector is k.</p>
</div>
<p>For details of Factorization Machine, please refer to the paper:
Factorization machines.</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>paddle.v2.config_base.Layer</em>) &#8211; The input layer. Supported input types: all input data types
on CPU, and only dense input types on GPU.</li>
<li><strong>factor_size</strong> &#8211; The hyperparameter that defines the dimensionality of
the latent vector size.</li>
<li><strong>act</strong> (<em>paddle.v2.activation.Base</em>) &#8211; Activation Type. Default is linear activation.</li>
<li><strong>param_attr</strong> (<em>paddle.v2.attr.ParameterAttribute</em>) &#8211; The parameter attribute. See paddle.v2.attr.ParameterAttribute for
details.</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttributeNone</em>) &#8211; Extra Layer config.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">paddle.v2.config_base.Layer object.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">paddle.v2.config_base.Layer</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
<div class="section" id="sampling-layers">
......@@ -3479,127 +3681,6 @@ details.</li>
</table>
</dd></dl>
</div>
</div>
<div class="section" id="factorization-machine-layer">
<h2>Factorization Machine Layer<a class="headerlink" href="#factorization-machine-layer" title="永久链接至标题"></a></h2>
<div class="section" id="factorization-machine">
<h3>factorization_machine<a class="headerlink" href="#factorization-machine" title="永久链接至标题"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">factorization_machine</code></dt>
<dd><p>The Factorization Machine models pairwise feature interactions as inner
product of the learned latent vectors corresponding to each input feature.
The Factorization Machine can effectively capture feature interactions
especially when the input is sparse.</p>
<p>This implementation only consider the 2-order feature interactions using
Factorization Machine with the formula:</p>
<div class="math">
\[y = \sum_{i=1}^{n-1}\sum_{j=i+1}^n\langle v_i, v_j \rangle x_i x_j\]</div>
<div class="admonition note">
<p class="first admonition-title">注解</p>
<p class="last">X is the input vector with size n. V is the factor matrix. Each row of V
is the latent vector corresponding to each input dimesion. The size of
each latent vector is k.</p>
</div>
<p>For details of Factorization Machine, please refer to the paper:
Factorization machines.</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>paddle.v2.config_base.Layer</em>) &#8211; The input layer. Supported input types: all input data types
on CPU, and only dense input types on GPU.</li>
<li><strong>factor_size</strong> &#8211; The hyperparameter that defines the dimensionality of
the latent vector size.</li>
<li><strong>act</strong> (<em>paddle.v2.activation.Base</em>) &#8211; Activation Type. Default is linear activation.</li>
<li><strong>param_attr</strong> (<em>paddle.v2.attr.ParameterAttribute</em>) &#8211; The parameter attribute. See paddle.v2.attr.ParameterAttribute for
details.</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttributeNone</em>) &#8211; Extra Layer config.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">paddle.v2.config_base.Layer object.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">paddle.v2.config_base.Layer</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
<div class="section" id="slicing-and-joining-layers">
<h2>Slicing and Joining Layers<a class="headerlink" href="#slicing-and-joining-layers" title="永久链接至标题"></a></h2>
<div class="section" id="pad">
<h3>pad<a class="headerlink" href="#pad" title="永久链接至标题"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">pad</code></dt>
<dd><p>This operation pads zeros to the input data according to pad_c,pad_h
and pad_w. pad_c, pad_h, pad_w specify the size in the corresponding
dimension. And the input data shape is NCHW.</p>
<p>For example, pad_c=[2,3] means padding 2 zeros before the input data
and 3 zeros after the input data in the channel dimension. pad_h means
padding zeros in the height dimension. pad_w means padding zeros in the
width dimension.</p>
<p>For example,</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="nb">input</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</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="o">=</span> <span class="p">[</span>
<span class="p">[</span> <span class="p">[[</span><span class="mi">1</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="p">[</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">]],</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">5</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span><span class="mi">7</span><span class="p">]]</span> <span class="p">],</span>
<span class="p">[</span> <span class="p">[[</span><span class="mi">4</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">7</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">3</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">9</span><span class="p">],</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">5</span><span class="p">]]</span> <span class="p">]</span>
<span class="p">]</span>
<span class="n">pad_c</span><span class="o">=</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span> <span class="n">pad_h</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="n">pad_w</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]</span>
<span class="n">output</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">4</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="o">=</span> <span class="p">[</span>
<span class="p">[</span> <span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">1</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="p">[</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">]],</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">5</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span><span class="mi">7</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]]</span> <span class="p">],</span>
<span class="p">[</span> <span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">4</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">7</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">3</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">9</span><span class="p">],</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">5</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]]</span> <span class="p">]</span>
<span class="p">]</span>
</pre></div>
</div>
<p>The simply usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">pad</span> <span class="o">=</span> <span class="n">pad</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="n">ipt</span><span class="p">,</span>
<span class="n">pad_c</span><span class="o">=</span><span class="p">[</span><span class="mi">4</span><span class="p">,</span><span class="mi">4</span><span class="p">],</span>
<span class="n">pad_h</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span>
<span class="n">pad_w</span><span class="o">=</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">])</span>
</pre></div>
</div>
<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>paddle.v2.config_base.Layer</em>) &#8211; The input of this layer.</li>
<li><strong>pad_c</strong> (<em>list | None</em>) &#8211; The padding size in the channel dimension.</li>
<li><strong>pad_h</strong> (<em>list | None</em>) &#8211; The padding size in the height dimension.</li>
<li><strong>pad_w</strong> (<em>list | None</em>) &#8211; The padding size in the width dimension.</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttribute</em>) &#8211; The extra layer attribute. See paddle.v2.attr.ExtraAttribute for
details.</li>
<li><strong>name</strong> (<em>basestring</em>) &#8211; The name of this layer. It is optional.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">paddle.v2.config_base.Layer object.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">paddle.v2.config_base.Layer</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
<div class="section" id="cost-layers">
......@@ -4365,32 +4446,29 @@ the positive bounding box.</li>
</dd></dl>
</div>
</div>
<div class="section" id="check-layer">
<h2>Check Layer<a class="headerlink" href="#check-layer" title="永久链接至标题"></a></h2>
<div class="section" id="eos">
<h3>eos<a class="headerlink" href="#eos" title="永久链接至标题"></a></h3>
<div class="section" id="detection-output">
<h3>detection_output<a class="headerlink" href="#detection-output" title="永久链接至标题"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">eos</code></dt>
<dd><p>A layer for checking EOS for each sample:
- output_id = (input_id == conf.eos_id)</p>
<p>The result is stored in output_.ids.
It is used by recurrent layer group.</p>
<p>The example usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">eos</span> <span class="o">=</span> <span class="n">eos</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">eos_id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
</pre></div>
</div>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">detection_output</code></dt>
<dd><p>Apply the NMS to the output of network and compute the predict bounding
box location. The output&#8217;s shape of this layer could be zero if there is
no valid bounding box.</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>name</strong> (<em>basestring</em>) &#8211; The name of this layer. It is optional.</li>
<li><strong>input</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; The input of this layer.</li>
<li><strong>eos_id</strong> (<em>int</em>) &#8211; End id of sequence</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttribute</em>) &#8211; The extra layer attribute. See paddle.v2.attr.ExtraAttribute for
details.</li>
<li><strong>input_loc</strong> (<em>paddle.v2.config_base.Layer | List of paddle.v2.config_base.Layer.</em>) &#8211; The input predict locations.</li>
<li><strong>input_conf</strong> (<em>paddle.v2.config_base.Layer | List of paddle.v2.config_base.Layer.</em>) &#8211; The input priorbox confidence.</li>
<li><strong>priorbox</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; The input priorbox location and the variance.</li>
<li><strong>num_classes</strong> (<em>int</em>) &#8211; The number of the classes.</li>
<li><strong>nms_threshold</strong> (<em>float</em>) &#8211; The Non-maximum suppression threshold.</li>
<li><strong>nms_top_k</strong> (<em>int</em>) &#8211; The bounding boxes number kept of the NMS&#8217;s output.</li>
<li><strong>keep_top_k</strong> (<em>int</em>) &#8211; The bounding boxes number kept of the layer&#8217;s output.</li>
<li><strong>confidence_threshold</strong> (<em>float</em>) &#8211; The classification confidence threshold.</li>
<li><strong>background_id</strong> (<em>int</em>) &#8211; The background class index.</li>
</ul>
</td>
</tr>
......@@ -4406,15 +4484,19 @@ details.</li>
</div>
</div>
<div class="section" id="miscs">
<h2>Miscs<a class="headerlink" href="#miscs" title="永久链接至标题"></a></h2>
<div class="section" id="dropout">
<h3>dropout<a class="headerlink" href="#dropout" title="永久链接至标题"></a></h3>
<div class="section" id="check-layer">
<h2>Check Layer<a class="headerlink" href="#check-layer" title="永久链接至标题"></a></h2>
<div class="section" id="eos">
<h3>eos<a class="headerlink" href="#eos" title="永久链接至标题"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">dropout</code></dt>
<dd><p>The example usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">dropout</span> <span class="o">=</span> <span class="n">dropout</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="nb">input</span><span class="p">,</span> <span class="n">dropout_rate</span><span class="o">=</span><span class="mf">0.5</span><span class="p">)</span>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">eos</code></dt>
<dd><p>A layer for checking EOS for each sample:
- output_id = (input_id == conf.eos_id)</p>
<p>The result is stored in output_.ids.
It is used by recurrent layer group.</p>
<p>The example usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">eos</span> <span class="o">=</span> <span class="n">eos</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">eos_id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
......@@ -4424,7 +4506,9 @@ details.</li>
<tr class="field-odd field"><th class="field-name">参数:</th><td class="field-body"><ul class="first simple">
<li><strong>name</strong> (<em>basestring</em>) &#8211; The name of this layer. It is optional.</li>
<li><strong>input</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; The input of this layer.</li>
<li><strong>dropout_rate</strong> (<em>float</em>) &#8211; The probability of dropout.</li>
<li><strong>eos_id</strong> (<em>int</em>) &#8211; End id of sequence</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttribute</em>) &#8211; The extra layer attribute. See paddle.v2.attr.ExtraAttribute for
details.</li>
</ul>
</td>
</tr>
......@@ -4440,8 +4524,8 @@ details.</li>
</div>
</div>
<div class="section" id="activation-with-learnable-parameter">
<h2>Activation with learnable parameter<a class="headerlink" href="#activation-with-learnable-parameter" title="永久链接至标题"></a></h2>
<div class="section" id="activation">
<h2>Activation<a class="headerlink" href="#activation" title="永久链接至标题"></a></h2>
<div class="section" id="prelu">
<h3>prelu<a class="headerlink" href="#prelu" title="永久链接至标题"></a></h3>
<dl class="class">
......@@ -4497,102 +4581,6 @@ details.</li>
</table>
</dd></dl>
</div>
<div class="section" id="gated-unit">
<h3>gated_unit<a class="headerlink" href="#gated-unit" title="永久链接至标题"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">gated_unit</code></dt>
<dd><p>The gated unit layer implements a simple gating mechanism over the input.
The input <span class="math">\(X\)</span> is first projected into a new space <span class="math">\(X'\)</span>, and
it is also used to produce a gate weight <span class="math">\(\sigma\)</span>. Element-wise
product between <span class="math">\(X'\)</span> and <span class="math">\(\sigma\)</span> is finally returned.</p>
<dl class="docutils">
<dt>Reference:</dt>
<dd><a class="reference external" href="https://arxiv.org/abs/1612.08083">Language Modeling with Gated Convolutional Networks</a></dd>
</dl>
<div class="math">
\[y=\text{act}(X \cdot W + b)\otimes \sigma(X \cdot V + c)\]</div>
<p>The example usage is:</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>paddle.v2.config_base.Layer</em>) &#8211; The input of this layer.</li>
<li><strong>size</strong> (<em>int</em>) &#8211; The dimension of this layer&#8217;s output.</li>
<li><strong>act</strong> (<em>paddle.v2.activation.Base</em>) &#8211; Activation type of the projection. paddle.v2.activation.Linear is the default
activation.</li>
<li><strong>name</strong> (<em>basestring</em>) &#8211; The name of this layer. It is optional.</li>
<li><strong>gate_attr</strong> (<em>paddle.v2.attr.ExtraAttribute | None</em>) &#8211; The extra layer attribute of the gate. See paddle.v2.attr.ExtraAttribute for
details.</li>
<li><strong>gate_param_attr</strong> (<em>paddle.v2.attr.ParameterAttribute</em>) &#8211; The parameter attribute of the gate. See paddle.v2.attr.ParameterAttribute
for details.</li>
<li><strong>gate_bias_attr</strong> (<em>paddle.v2.attr.ParameterAttribute | bool | None | Any</em>) &#8211; The bias attribute of the gate. If this parameter is set to False or
an object whose type is not paddle.v2.attr.ParameterAttribute, no bias is defined.
If this parameter is set to True, the bias is initialized to zero.</li>
<li><strong>inproj_attr</strong> (<em>paddle.v2.attr.ExtraAttribute | None</em>) &#8211; Extra layer attributes of the projection. See paddle.v2.attr.ExtraAttribute for
details.</li>
<li><strong>inproj_param_attr</strong> (<em>paddle.v2.attr.ParameterAttribute</em>) &#8211; The parameter attribute of the projection. See paddle.v2.attr.ParameterAttribute
for details.</li>
<li><strong>inproj_bias_attr</strong> (<em>paddle.v2.attr.ParameterAttribute | bool | None | Any</em>) &#8211; The bias attribute of the projection. If this parameter is set to False
or an object whose type is not paddle.v2.attr.ParameterAttribute, no bias is defined.
If this parameter is set to True, the bias is initialized to zero.</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttribute | None</em>) &#8211; Extra layer attribute of the product. See paddle.v2.attr.ExtraAttribute for
details.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">paddle.v2.config_base.Layer object.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">paddle.v2.config_base.Layer</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
<div class="section" id="detection-output-layer">
<h2>Detection output Layer<a class="headerlink" href="#detection-output-layer" title="永久链接至标题"></a></h2>
<div class="section" id="detection-output">
<h3>detection_output<a class="headerlink" href="#detection-output" title="永久链接至标题"></a></h3>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">detection_output</code></dt>
<dd><p>Apply the NMS to the output of network and compute the predict bounding
box location. The output&#8217;s shape of this layer could be zero if there is
no valid bounding box.</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>name</strong> (<em>basestring</em>) &#8211; The name of this layer. It is optional.</li>
<li><strong>input_loc</strong> (<em>paddle.v2.config_base.Layer | List of paddle.v2.config_base.Layer.</em>) &#8211; The input predict locations.</li>
<li><strong>input_conf</strong> (<em>paddle.v2.config_base.Layer | List of paddle.v2.config_base.Layer.</em>) &#8211; The input priorbox confidence.</li>
<li><strong>priorbox</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; The input priorbox location and the variance.</li>
<li><strong>num_classes</strong> (<em>int</em>) &#8211; The number of the classes.</li>
<li><strong>nms_threshold</strong> (<em>float</em>) &#8211; The Non-maximum suppression threshold.</li>
<li><strong>nms_top_k</strong> (<em>int</em>) &#8211; The bounding boxes number kept of the NMS&#8217;s output.</li>
<li><strong>keep_top_k</strong> (<em>int</em>) &#8211; The bounding boxes number kept of the layer&#8217;s output.</li>
<li><strong>confidence_threshold</strong> (<em>float</em>) &#8211; The classification confidence threshold.</li>
<li><strong>background_id</strong> (<em>int</em>) &#8211; The background class index.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">paddle.v2.config_base.Layer object.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">paddle.v2.config_base.Layer</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
</div>
......
......@@ -748,6 +748,191 @@ sequence.</p>
<dd><p>Converts dataset to recordio format</p>
</dd></dl>
</div>
<div class="section" id="wmt16">
<h2>wmt16<a class="headerlink" href="#wmt16" title="永久链接至标题"></a></h2>
<p>ACL2016 Multimodal Machine Translation. Please see this website for more
details: <a class="reference external" href="http://www.statmt.org/wmt16/multimodal-task.html#task1">http://www.statmt.org/wmt16/multimodal-task.html#task1</a></p>
<p>If you use the dataset created for your task, please cite the following paper:
Multi30K: Multilingual English-German Image Descriptions.</p>
<dl class="docutils">
<dt>&#64;article{elliott-EtAl:2016:VL16,</dt>
<dd>author = {{Elliott}, D. and {Frank}, S. and {Sima&#8221;an}, K. and {Specia}, L.},
title = {Multi30K: Multilingual English-German Image Descriptions},
booktitle = {Proceedings of the 6th Workshop on Vision and Language},
year = {2016},
pages = {70&#8211;74},
year = 2016</dd>
</dl>
<p>}</p>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.dataset.wmt16.</code><code class="descname">train</code><span class="sig-paren">(</span><em>src_dict_size</em>, <em>trg_dict_size</em>, <em>src_lang='en'</em><span class="sig-paren">)</span></dt>
<dd><p>WMT16 train set reader.</p>
<p>This function returns the reader for train data. Each sample the reader
returns is made up of three fields: the source language word index sequence,
target language word index sequence and next word index sequence.</p>
<p>NOTE:
The original like for training data is:
<a class="reference external" href="http://www.quest.dcs.shef.ac.uk/wmt16_files_mmt/training.tar.gz">http://www.quest.dcs.shef.ac.uk/wmt16_files_mmt/training.tar.gz</a></p>
<p>paddle.dataset.wmt16 provides a tokenized version of the original dataset by
using moses&#8217;s tokenization script:
<a class="reference external" href="https://github.com/moses-smt/mosesdecoder/blob/master/scripts/tokenizer/tokenizer.perl">https://github.com/moses-smt/mosesdecoder/blob/master/scripts/tokenizer/tokenizer.perl</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>src_dict_size</strong> (<em>int</em>) &#8211; Size of the source language dictionary. Three
special tokens will be added into the dictionary:
&lt;s&gt; for start mark, &lt;e&gt; for end mark, and &lt;unk&gt; for
unknown word.</li>
<li><strong>trg_dict_size</strong> (<em>int</em>) &#8211; Size of the target language dictionary. Three
special tokens will be added into the dictionary:
&lt;s&gt; for start mark, &lt;e&gt; for end mark, and &lt;unk&gt; for
unknown word.</li>
<li><strong>src_lang</strong> (<em>string</em>) &#8211; A string indicating which language is the source
language. Available options are: &#8220;en&#8221; for English
and &#8220;de&#8221; for Germany.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">The train reader.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">callable</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.dataset.wmt16.</code><code class="descname">test</code><span class="sig-paren">(</span><em>src_dict_size</em>, <em>trg_dict_size</em>, <em>src_lang='en'</em><span class="sig-paren">)</span></dt>
<dd><p>WMT16 test set reader.</p>
<p>This function returns the reader for test data. Each sample the reader
returns is made up of three fields: the source language word index sequence,
target language word index sequence and next word index sequence.</p>
<p>NOTE:
The original like for test data is:
<a class="reference external" href="http://www.quest.dcs.shef.ac.uk/wmt16_files_mmt/mmt16_task1_test.tar.gz">http://www.quest.dcs.shef.ac.uk/wmt16_files_mmt/mmt16_task1_test.tar.gz</a></p>
<p>paddle.dataset.wmt16 provides a tokenized version of the original dataset by
using moses&#8217;s tokenization script:
<a class="reference external" href="https://github.com/moses-smt/mosesdecoder/blob/master/scripts/tokenizer/tokenizer.perl">https://github.com/moses-smt/mosesdecoder/blob/master/scripts/tokenizer/tokenizer.perl</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>src_dict_size</strong> (<em>int</em>) &#8211; Size of the source language dictionary. Three
special tokens will be added into the dictionary:
&lt;s&gt; for start mark, &lt;e&gt; for end mark, and &lt;unk&gt; for
unknown word.</li>
<li><strong>trg_dict_size</strong> (<em>int</em>) &#8211; Size of the target language dictionary. Three
special tokens will be added into the dictionary:
&lt;s&gt; for start mark, &lt;e&gt; for end mark, and &lt;unk&gt; for
unknown word.</li>
<li><strong>src_lang</strong> (<em>string</em>) &#8211; A string indicating which language is the source
language. Available options are: &#8220;en&#8221; for English
and &#8220;de&#8221; for Germany.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">The test reader.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">callable</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.dataset.wmt16.</code><code class="descname">validation</code><span class="sig-paren">(</span><em>src_dict_size</em>, <em>trg_dict_size</em>, <em>src_lang='en'</em><span class="sig-paren">)</span></dt>
<dd><p>WMT16 validation set reader.</p>
<p>This function returns the reader for validation data. Each sample the reader
returns is made up of three fields: the source language word index sequence,
target language word index sequence and next word index sequence.</p>
<p>NOTE:
The original like for validation data is:
<a class="reference external" href="http://www.quest.dcs.shef.ac.uk/wmt16_files_mmt/validation.tar.gz">http://www.quest.dcs.shef.ac.uk/wmt16_files_mmt/validation.tar.gz</a></p>
<p>paddle.dataset.wmt16 provides a tokenized version of the original dataset by
using moses&#8217;s tokenization script:
<a class="reference external" href="https://github.com/moses-smt/mosesdecoder/blob/master/scripts/tokenizer/tokenizer.perl">https://github.com/moses-smt/mosesdecoder/blob/master/scripts/tokenizer/tokenizer.perl</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>src_dict_size</strong> (<em>int</em>) &#8211; Size of the source language dictionary. Three
special tokens will be added into the dictionary:
&lt;s&gt; for start mark, &lt;e&gt; for end mark, and &lt;unk&gt; for
unknown word.</li>
<li><strong>trg_dict_size</strong> (<em>int</em>) &#8211; Size of the target language dictionary. Three
special tokens will be added into the dictionary:
&lt;s&gt; for start mark, &lt;e&gt; for end mark, and &lt;unk&gt; for
unknown word.</li>
<li><strong>src_lang</strong> (<em>string</em>) &#8211; A string indicating which language is the source
language. Available options are: &#8220;en&#8221; for English
and &#8220;de&#8221; for Germany.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">The validation reader.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">callable</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.dataset.wmt16.</code><code class="descname">get_dict</code><span class="sig-paren">(</span><em>lang</em>, <em>dict_size</em>, <em>reverse=False</em><span class="sig-paren">)</span></dt>
<dd><p>return the word dictionary for the specified language.</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>lang</strong> (<em>string</em>) &#8211; A string indicating which language is the source
language. Available options are: &#8220;en&#8221; for English
and &#8220;de&#8221; for Germany.</li>
<li><strong>dict_size</strong> (<em>int</em>) &#8211; Size of the specified language dictionary.</li>
<li><strong>reverse</strong> (<em>bool</em>) &#8211; If reverse is set to False, the returned python
dictionary will use word as key and use index as value.
If reverse is set to True, the returned python
dictionary will use index as key and word as value.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">The word dictionary for the specific language.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">dict</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.dataset.wmt16.</code><code class="descname">fetch</code><span class="sig-paren">(</span><span class="sig-paren">)</span></dt>
<dd><p>download the entire dataset.</p>
</dd></dl>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.dataset.wmt16.</code><code class="descname">convert</code><span class="sig-paren">(</span><em>path</em>, <em>src_dict_size</em>, <em>trg_dict_size</em>, <em>src_lang</em><span class="sig-paren">)</span></dt>
<dd><p>Converts dataset to recordio format.</p>
</dd></dl>
</div>
</div>
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册