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

Deploy to GitHub Pages: 797249bc

上级 4e88e677
......@@ -3847,9 +3847,13 @@ should be consistent as that used in your labels.</li>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">nce</code></dt>
<dd><p>Noise-contrastive estimation.
Implements the method in the following paper:
A fast and simple algorithm for training neural probabilistic language models.</p>
<dd><p>Noise-contrastive estimation. This layer implements the method in the
following paper:</p>
<dl class="docutils">
<dt>Reference:</dt>
<dd>A fast and simple algorithm for training neural probabilistic language
models. <a class="reference external" href="https://www.cs.toronto.edu/~amnih/papers/ncelm.pdf">https://www.cs.toronto.edu/~amnih/papers/ncelm.pdf</a></dd>
</dl>
<p>The example usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">cost</span> <span class="o">=</span> <span class="n">nce</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="p">[</span><span class="n">layer1</span><span class="p">,</span> <span class="n">layer2</span><span class="p">],</span> <span class="n">label</span><span class="o">=</span><span class="n">layer2</span><span class="p">,</span>
<span class="n">param_attr</span><span class="o">=</span><span class="p">[</span><span class="n">attr1</span><span class="p">,</span> <span class="n">attr2</span><span class="p">],</span> <span class="n">weight</span><span class="o">=</span><span class="n">layer3</span><span class="p">,</span>
......@@ -3862,24 +3866,31 @@ A fast and simple algorithm for training neural probabilistic language models.</
<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 | list | tuple | collections.Sequence</em>) &#8211; The input layers. It could be a paddle.v2.config_base.Layer of list/tuple of paddle.v2.config_base.Layer.</li>
<li><strong>label</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; label layer</li>
<li><strong>weight</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; weight layer, can be None(default)</li>
<li><strong>num_classes</strong> (<em>int</em>) &#8211; number of classes.</li>
<li><strong>act</strong> (<em>paddle.v2.activation.Base</em>) &#8211; Activation type. paddle.v2.activation.Sigmoid is the default.</li>
<li><strong>param_attr</strong> (<em>paddle.v2.attr.ParameterAttribute</em>) &#8211; The Parameter Attribute|list.</li>
<li><strong>num_neg_samples</strong> (<em>int</em>) &#8211; number of negative samples. Default is 10.</li>
<li><strong>neg_distribution</strong> (<em>list | tuple | collections.Sequence | None</em>) &#8211; The distribution for generating the random negative labels.
A uniform distribution will be used if not provided.
If not None, its length must be equal to num_classes.</li>
<li><strong>bias_attr</strong> (<em>paddle.v2.attr.ParameterAttribute | None | bool | Any</em>) &#8211; The bias attribute. If the parameter is set to False or an object
whose type is not paddle.v2.attr.ParameterAttribute, no bias is defined. If the
parameter is set to True, the bias is initialized to zero.</li>
<li><strong>input</strong> (<em>paddle.v2.config_base.Layer | list | tuple | collections.Sequence</em>) &#8211; The input layers. It should be a paddle.v2.config_base.Layer or a list/tuple
of paddle.v2.config_base.Layer.</li>
<li><strong>label</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; The ground truth.</li>
<li><strong>weight</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; The weight layer defines a weight for each sample in the
mini-batch. The default value is None.</li>
<li><strong>num_classes</strong> (<em>int</em>) &#8211; The class number.</li>
<li><strong>param_attr</strong> (<em>paddle.v2.attr.ParameterAttribute|list</em>) &#8211; The parameter attributes.</li>
<li><strong>num_neg_samples</strong> (<em>int</em>) &#8211; The number of sampled negative labels. The default
value is 10.</li>
<li><strong>neg_distribution</strong> (<em>list | tuple | collections.Sequence | None</em>) &#8211; The discrete noisy distribution over the output
space from which num_neg_samples negative labels
are sampled. If this parameter is not set, a
uniform distribution will be used. A user defined
distribution is a list whose length must be equal
to the num_classes. Each member of the list defines
the probability of a class given input x.</li>
<li><strong>bias_attr</strong> (<em>paddle.v2.attr.ParameterAttribute | None | bool | Any</em>) &#8211; The attribute for bias. If this parameter is set False or
any object whose type is not paddle.v2.attr.ParameterAttribute, no bias
is added. If this parameter is set True, the bias is
initialized to zero.</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttribute</em>) &#8211; Extra Layer Attribute.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">layer name.</p>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The 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>
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -3861,9 +3861,13 @@ should be consistent as that used in your labels.</li>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.layer.</code><code class="descname">nce</code></dt>
<dd><p>Noise-contrastive estimation.
Implements the method in the following paper:
A fast and simple algorithm for training neural probabilistic language models.</p>
<dd><p>Noise-contrastive estimation. This layer implements the method in the
following paper:</p>
<dl class="docutils">
<dt>Reference:</dt>
<dd>A fast and simple algorithm for training neural probabilistic language
models. <a class="reference external" href="https://www.cs.toronto.edu/~amnih/papers/ncelm.pdf">https://www.cs.toronto.edu/~amnih/papers/ncelm.pdf</a></dd>
</dl>
<p>The example usage is:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">cost</span> <span class="o">=</span> <span class="n">nce</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="p">[</span><span class="n">layer1</span><span class="p">,</span> <span class="n">layer2</span><span class="p">],</span> <span class="n">label</span><span class="o">=</span><span class="n">layer2</span><span class="p">,</span>
<span class="n">param_attr</span><span class="o">=</span><span class="p">[</span><span class="n">attr1</span><span class="p">,</span> <span class="n">attr2</span><span class="p">],</span> <span class="n">weight</span><span class="o">=</span><span class="n">layer3</span><span class="p">,</span>
......@@ -3876,24 +3880,31 @@ A fast and simple algorithm for training neural probabilistic language models.</
<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 | list | tuple | collections.Sequence</em>) &#8211; The input layers. It could be a paddle.v2.config_base.Layer of list/tuple of paddle.v2.config_base.Layer.</li>
<li><strong>label</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; label layer</li>
<li><strong>weight</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; weight layer, can be None(default)</li>
<li><strong>num_classes</strong> (<em>int</em>) &#8211; number of classes.</li>
<li><strong>act</strong> (<em>paddle.v2.activation.Base</em>) &#8211; Activation type. paddle.v2.activation.Sigmoid is the default.</li>
<li><strong>param_attr</strong> (<em>paddle.v2.attr.ParameterAttribute</em>) &#8211; The Parameter Attribute|list.</li>
<li><strong>num_neg_samples</strong> (<em>int</em>) &#8211; number of negative samples. Default is 10.</li>
<li><strong>neg_distribution</strong> (<em>list | tuple | collections.Sequence | None</em>) &#8211; The distribution for generating the random negative labels.
A uniform distribution will be used if not provided.
If not None, its length must be equal to num_classes.</li>
<li><strong>bias_attr</strong> (<em>paddle.v2.attr.ParameterAttribute | None | bool | Any</em>) &#8211; The bias attribute. If the parameter is set to False or an object
whose type is not paddle.v2.attr.ParameterAttribute, no bias is defined. If the
parameter is set to True, the bias is initialized to zero.</li>
<li><strong>input</strong> (<em>paddle.v2.config_base.Layer | list | tuple | collections.Sequence</em>) &#8211; The input layers. It should be a paddle.v2.config_base.Layer or a list/tuple
of paddle.v2.config_base.Layer.</li>
<li><strong>label</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; The ground truth.</li>
<li><strong>weight</strong> (<em>paddle.v2.config_base.Layer</em>) &#8211; The weight layer defines a weight for each sample in the
mini-batch. The default value is None.</li>
<li><strong>num_classes</strong> (<em>int</em>) &#8211; The class number.</li>
<li><strong>param_attr</strong> (<em>paddle.v2.attr.ParameterAttribute|list</em>) &#8211; The parameter attributes.</li>
<li><strong>num_neg_samples</strong> (<em>int</em>) &#8211; The number of sampled negative labels. The default
value is 10.</li>
<li><strong>neg_distribution</strong> (<em>list | tuple | collections.Sequence | None</em>) &#8211; The discrete noisy distribution over the output
space from which num_neg_samples negative labels
are sampled. If this parameter is not set, a
uniform distribution will be used. A user defined
distribution is a list whose length must be equal
to the num_classes. Each member of the list defines
the probability of a class given input x.</li>
<li><strong>bias_attr</strong> (<em>paddle.v2.attr.ParameterAttribute | None | bool | Any</em>) &#8211; The attribute for bias. If this parameter is set False or
any object whose type is not paddle.v2.attr.ParameterAttribute, no bias
is added. If this parameter is set True, the bias is
initialized to zero.</li>
<li><strong>layer_attr</strong> (<em>paddle.v2.attr.ExtraAttribute</em>) &#8211; Extra Layer Attribute.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">layer name.</p>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">The 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>
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册