提交 1f6276b7 编写于 作者: T Travis CI

Deploy to GitHub Pages: 7910d96a

上级 0d8b37ce
......@@ -214,6 +214,75 @@
<h1>Evaluator<a class="headerlink" href="#evaluator" title="Permalink to this headline"></a></h1>
<div class="section" id="id1">
<h2>Evaluator<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.evaluator.</code><code class="descname">Evaluator</code><span class="sig-paren">(</span><em>name</em>, <em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Base Class for all evaluators</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 last simple">
<li><strong>name</strong> (<em>str</em>) &#8211; The name of evaluator. such as, &#8220;accuracy&#8221;. Used for generate
temporary variable name.</li>
<li><strong>main_program</strong> (<em>Program</em><em>, </em><em>optional</em>) &#8211; The evaluator should be added to this
main_program. Default default_main_program()</li>
<li><strong>startup_program</strong> (<em>Program</em><em>, </em><em>optional</em>) &#8211; The parameter should be added to this
startup_program. Default default_startup_program()</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="paddle.v2.fluid.evaluator.Evaluator.states">
<code class="descname">states</code><a class="headerlink" href="#paddle.v2.fluid.evaluator.Evaluator.states" title="Permalink to this definition"></a></dt>
<dd><p><em>list</em> &#8211; The list of state variables. states will be reset to zero
when <cite>reset</cite> is invoked.</p>
</dd></dl>
<dl class="attribute">
<dt id="paddle.v2.fluid.evaluator.Evaluator.metrics">
<code class="descname">metrics</code><a class="headerlink" href="#paddle.v2.fluid.evaluator.Evaluator.metrics" title="Permalink to this definition"></a></dt>
<dd><p><em>list</em> &#8211; The list of metrics variables. They will be calculate
every mini-batch</p>
</dd></dl>
<dl class="method">
<dt>
<code class="descname">reset</code><span class="sig-paren">(</span><em>executor</em>, <em>reset_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>reset metric states at the begin of each pass/user specified batch</p>
</dd></dl>
<dl class="method">
<dt>
<code class="descname">eval</code><span class="sig-paren">(</span><em>executor</em>, <em>eval_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>Evaluate the statistics merged by multiple mini-batches.</p>
</dd></dl>
<dl class="method">
<dt>
<code class="descname">create_state</code><span class="sig-paren">(</span><em>suffix</em>, <em>dtype</em>, <em>shape</em><span class="sig-paren">)</span></dt>
<dd><p>Create state variable.</p>
<p>NOTE: It is not a public API.</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 last simple">
<li><strong>suffix</strong> (<em>str</em>) &#8211; the state suffix.</li>
<li><strong>dtype</strong> (<em>str|core.DataType</em>) &#8211; the state data type</li>
<li><strong>shape</strong> (<em>tuple|list</em>) &#8211; the shape of state</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns: State variable</p>
</dd></dl>
</dd></dl>
</div>
</div>
......
......@@ -214,21 +214,90 @@
<h1>Initializer<a class="headerlink" href="#initializer" title="Permalink to this headline"></a></h1>
<div class="section" id="id1">
<h2>Initializer<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.initializer.</code><code class="descname">Initializer</code></dt>
<dd><p>Base class for variable initializers</p>
<p>Defines the common interface of variable initializers.
They add operations to the init program that are used
to initialize variables. Users should not use this class
directly, but need to use one of its implementations.</p>
</dd></dl>
</div>
<div class="section" id="constantinitializer">
<h2>ConstantInitializer<a class="headerlink" href="#constantinitializer" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.initializer.</code><code class="descname">ConstantInitializer</code><span class="sig-paren">(</span><em>value=0.0</em><span class="sig-paren">)</span></dt>
<dd><p>Implements the constant initializer</p>
</dd></dl>
</div>
<div class="section" id="uniforminitializer">
<h2>UniformInitializer<a class="headerlink" href="#uniforminitializer" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.initializer.</code><code class="descname">UniformInitializer</code><span class="sig-paren">(</span><em>low=-1.0</em>, <em>high=1.0</em>, <em>seed=0</em><span class="sig-paren">)</span></dt>
<dd><p>Implements the random uniform distribution initializer</p>
</dd></dl>
</div>
<div class="section" id="normalinitializer">
<h2>NormalInitializer<a class="headerlink" href="#normalinitializer" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.initializer.</code><code class="descname">NormalInitializer</code><span class="sig-paren">(</span><em>loc=0.0</em>, <em>scale=1.0</em>, <em>seed=0</em><span class="sig-paren">)</span></dt>
<dd><p>Implements the random Normal(Gaussian) distribution initializer</p>
</dd></dl>
</div>
<div class="section" id="xavierinitializer">
<h2>XavierInitializer<a class="headerlink" href="#xavierinitializer" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.initializer.</code><code class="descname">XavierInitializer</code><span class="sig-paren">(</span><em>uniform=True</em>, <em>fan_in=None</em>, <em>fan_out=None</em>, <em>seed=0</em><span class="sig-paren">)</span></dt>
<dd><p>Implements the Xavier initializer</p>
<p>This class implements the Xavier weight initializer from the paper
Understanding the difficulty of training deep feedforward neural
networks[1] by Xavier Glorot and Yoshua Bengio.</p>
<p>This initializer is designed to keep the scale of the gradients
approximately same in all the layers. In case of Uniform distribution,
the range is [-x, x], where x = sqrt(6 / (fan_in + fan_out)).
In case of Normal distribution, the mean is 0 and the standard deviation
is sqrt(2/ (fan_in + fan_out)).</p>
<p class="rubric">References</p>
<dl class="docutils">
<dt>[1] Understanding the difficulty of training deep feedforward neural</dt>
<dd>networks. International conference on artificial intelligence and
statistics.
(<a class="reference external" href="http://proceedings.mlr.press/v9/glorot10a.html">http://proceedings.mlr.press/v9/glorot10a.html</a>)</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="msrainitializer">
<h2>MSRAInitializer<a class="headerlink" href="#msrainitializer" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.initializer.</code><code class="descname">MSRAInitializer</code><span class="sig-paren">(</span><em>uniform=True</em>, <em>fan_in=None</em>, <em>seed=0</em><span class="sig-paren">)</span></dt>
<dd><p>Implements the MSRA initializer a.k.a. Kaiming Initializer</p>
<p>This class implements the weight initialization from the paper
Delving Deep into Rectifiers: Surpassing Human-Level Performance on
ImageNet Classification[1] by Kaiming He, Xiangyu Zhang, Shaoqing Ren
and Jian Sun. This is a robust initialization method that particularly
considers the rectifier nonlinearities. In case of Uniform distribution,
the range is [-x, x], where x = sqrt(6 / fan_in). In case of Normal
distribution, the mean is 0 and the standard deviation
is sqrt(2/ fan_in).</p>
<p class="rubric">References</p>
<dl class="docutils">
<dt>[1] Delving Deep into Rectifiers: Surpassing Human-Level Performance</dt>
<dd>on ImageNet Classification
(<a class="reference external" href="https://arxiv.org/abs/1502.01852">https://arxiv.org/abs/1502.01852</a>)</dd>
</dl>
</dd></dl>
</div>
</div>
......
......@@ -214,153 +214,859 @@
<h1>Layers<a class="headerlink" href="#layers" title="Permalink to this headline"></a></h1>
<div class="section" id="fc">
<h2>fc<a class="headerlink" href="#fc" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">fc</code><span class="sig-paren">(</span><em>input</em>, <em>size</em>, <em>num_flatten_dims=1</em>, <em>param_attr=None</em>, <em>bias_attr=None</em>, <em>act=None</em>, <em>name=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>Fully Connected Layer.</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 last simple">
<li><strong>input</strong> &#8211; The input tensor to the function</li>
<li><strong>size</strong> &#8211; The size of the layer</li>
<li><strong>num_flatten_dims</strong> &#8211; Number of columns in input</li>
<li><strong>param_attr</strong> &#8211; The parameters/weights to the FC Layer</li>
<li><strong>param_initializer</strong> &#8211; Initializer used for the weight/parameter. If None, XavierInitializer() is used</li>
<li><strong>bias_attr</strong> &#8211; The bias parameter for the FC layer</li>
<li><strong>bias_initializer</strong> &#8211; Initializer used for the bias. If None, then ConstantInitializer() is used</li>
<li><strong>act</strong> &#8211; Activation to be applied to the output of FC layer</li>
<li><strong>name</strong> &#8211; Name/alias of the function</li>
<li><strong>main_program</strong> &#8211; Name of the main program that calls this</li>
<li><strong>startup_program</strong> &#8211; Name of the startup program</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This function can take in multiple inputs and performs the Fully Connected
function (linear transformation) on top of each of them.
So for input x, the output will be : Wx + b. Where W is the parameter,
b the bias and x is the input.</p>
<p>The function also applies an activation (non-linearity) on top of the
output, if activation is passed in the input.</p>
<p>All the input variables of this function are passed in as local variables
to the LayerHelper constructor.</p>
</dd></dl>
</div>
<div class="section" id="embedding">
<h2>embedding<a class="headerlink" href="#embedding" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">embedding</code><span class="sig-paren">(</span><em>input</em>, <em>size</em>, <em>is_sparse=False</em>, <em>param_attr=None</em>, <em>dtype='float32'</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>Embedding Layer.</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 last simple">
<li><strong>param_initializer</strong> &#8211; </li>
<li><strong>input</strong> &#8211; The input to the function</li>
<li><strong>size</strong> &#8211; The size of the layer</li>
<li><strong>is_sparse</strong> &#8211; A flag that decleares whether the input is sparse</li>
<li><strong>param_attr</strong> &#8211; Parameters for this layer</li>
<li><strong>dtype</strong> &#8211; The type of data : float32, float_16, int etc</li>
<li><strong>main_program</strong> &#8211; Name of the main program that calls this</li>
<li><strong>startup_program</strong> &#8211; Name of the startup program</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This function can take in the input (which is a vector of IDs) and
performs a lookup in the lookup_table using these IDs, to result into
the embedding of each ID in the input.</p>
<p>All the input variables of this function are passed in as local variables
to the LayerHelper constructor.</p>
</dd></dl>
</div>
<div class="section" id="dynamic-lstm">
<h2>dynamic_lstm<a class="headerlink" href="#dynamic-lstm" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">dynamic_lstm</code><span class="sig-paren">(</span><em>input</em>, <em>size</em>, <em>param_attr=None</em>, <em>bias_attr=None</em>, <em>use_peepholes=True</em>, <em>is_reverse=False</em>, <em>gate_activation='sigmoid'</em>, <em>cell_activation='tanh'</em>, <em>candidate_activation='tanh'</em>, <em>dtype='float32'</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="data">
<h2>data<a class="headerlink" href="#data" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">data</code><span class="sig-paren">(</span><em>name</em>, <em>shape</em>, <em>append_batch_size=True</em>, <em>dtype='float32'</em>, <em>lod_level=0</em>, <em>type=VarType.LOD_TENSOR</em>, <em>main_program=None</em>, <em>startup_program=None</em>, <em>stop_gradient=True</em><span class="sig-paren">)</span></dt>
<dd><p>Data Layer.</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 last simple">
<li><strong>name</strong> &#8211; The name/alias of the function</li>
<li><strong>shape</strong> &#8211; Tuple declaring the shape.</li>
<li><strong>append_batch_size</strong> &#8211; Whether or not to append the data as a batch.</li>
<li><strong>dtype</strong> &#8211; The type of data : float32, float_16, int etc</li>
<li><strong>type</strong> &#8211; The output type. By default it is LOD_TENSOR.</li>
<li><strong>lod_level</strong> (<em>int</em>) &#8211; The LoD Level. 0 means the input data is not a sequence.</li>
<li><strong>main_program</strong> &#8211; Name of the main program that calls this</li>
<li><strong>startup_program</strong> &#8211; Name of the startup program</li>
<li><strong>stop_gradient</strong> &#8211; A boolean that mentions whether gradient should flow.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This function takes in input and based on whether data has
to be returned back as a minibatch, it creates the global variable using
the helper functions. The global variables can be accessed by all the
following operations and layers in the graph.</p>
<p>All the input variables of this function are passed in as local variables
to the LayerHelper constructor.</p>
</dd></dl>
</div>
<div class="section" id="mean">
<h2>mean<a class="headerlink" href="#mean" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">mean</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Mean Operator.</p>
<p>Out is a scalar which is the mean of all elements in X.</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"><strong>x</strong> &#8211; The input of mean op
Duplicable: False Optional: False</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The output of mean op</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="mul">
<h2>mul<a class="headerlink" href="#mul" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">mul</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Mul Operator.</p>
<p>This operator is used to perform matrix multiplication for input X and Y.</p>
<p>The equation is:</p>
<blockquote>
<div>$$Out = X * Y$$</div></blockquote>
<p>Both the input <cite>X</cite> and <cite>Y</cite> can carry the LoD (Level of Details) information,
or not. But the output only shares the LoD information with input <cite>X</cite>.</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>x</strong> &#8211; The first input of mul op
Duplicable: False Optional: False</li>
<li><strong>y</strong> &#8211; The second input of mul op
Duplicable: False Optional: False</li>
<li><strong>x_num_col_dims</strong> (<em>INT</em>) &#8211; (int, default 1) mul_op can take tensors with more than two dimensions as input <cite>X</cite>,
in that case, tensors will be reshaped to a matrix. The matrix&#8217;s first
dimension(column length) will be the product of tensor&#8217;s last
<cite>num_col_dims</cite> dimensions, and the matrix&#8217;s second dimension(row length)
will be the product of tensor&#8217;s first <cite>rank - num_col_dims</cite> dimensions.</li>
<li><strong>y_num_col_dims</strong> (<em>INT</em>) &#8211; (int, default 1) mul_op can take tensors with more than two dimensions as input <cite>Y</cite>,
in that case, tensors will be reshaped to a matrix. Just like input <cite>X</cite>.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">The output of mul op</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="elementwise-add">
<h2>elementwise_add<a class="headerlink" href="#elementwise-add" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">elementwise_add</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Limited Elementwise Add Operator.</p>
<p>The equation is:</p>
<p>$Out = X + Y$</p>
<p>X is a tensor of any dimension and the dimensions of tensor Y must be smaller than
or equal to the dimensions of X.</p>
<p>There are two cases for this operator:
1. The shape of Y is same with X;
2. The shape of Y is a subset of X.</p>
<p>For case 2:
Y will be broadcasted to match the shape of X and axis should be
the starting dimension index for broadcasting Y onto X.</p>
<p class="rubric">example</p>
<p>shape(X) = (2, 3, 4, 5), shape(Y) = (,)
shape(X) = (2, 3, 4, 5), shape(Y) = (5,)
shape(X) = (2, 3, 4, 5), shape(Y) = (4, 5)
shape(X) = (2, 3, 4, 5), shape(Y) = (3, 4), with axis=1
shape(X) = (2, 3, 4, 5), shape(Y) = (2), with axis=0</p>
<p>Both the input X and Y can carry the LoD (Level of Details) information,
or not. But the output only shares the LoD information with input X.</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>x</strong> &#8211; (Tensor) The first input tensor of elementwise op
Duplicable: False Optional: False</li>
<li><strong>y</strong> &#8211; (Tensor) The second input tensor of elementwise op
Duplicable: False Optional: False</li>
<li><strong>axis</strong> (<em>INT</em>) &#8211; (int, default -1) The starting dimension index for broadcasting Y onto X</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">The output of elementwise op</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="elementwise-div">
<h2>elementwise_div<a class="headerlink" href="#elementwise-div" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">elementwise_div</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Limited Elementwise Div Operator.</p>
<p>The equation is:</p>
<p>$Out = X / Y$</p>
<p>X is a tensor of any dimension and the dimensions of tensor Y must be smaller than
or equal to the dimensions of X.</p>
<p>There are two cases for this operator:
1. The shape of Y is same with X;
2. The shape of Y is a subset of X.</p>
<p>For case 2:
Y will be broadcasted to match the shape of X and axis should be
the starting dimension index for broadcasting Y onto X.</p>
<p class="rubric">example</p>
<p>shape(X) = (2, 3, 4, 5), shape(Y) = (,)
shape(X) = (2, 3, 4, 5), shape(Y) = (5,)
shape(X) = (2, 3, 4, 5), shape(Y) = (4, 5)
shape(X) = (2, 3, 4, 5), shape(Y) = (3, 4), with axis=1
shape(X) = (2, 3, 4, 5), shape(Y) = (2), with axis=0</p>
<p>Both the input X and Y can carry the LoD (Level of Details) information,
or not. But the output only shares the LoD information with input X.</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>x</strong> &#8211; (Tensor) The first input tensor of elementwise op
Duplicable: False Optional: False</li>
<li><strong>y</strong> &#8211; (Tensor) The second input tensor of elementwise op
Duplicable: False Optional: False</li>
<li><strong>axis</strong> (<em>INT</em>) &#8211; (int, default -1) The starting dimension index for broadcasting Y onto X</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">The output of elementwise op</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="dropout">
<h2>dropout<a class="headerlink" href="#dropout" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">dropout</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Dropout Operator.</p>
<p>Dropout refers to randomly dropping out units in a nerual network. It is a
regularization technique for reducing overfitting by preventing neuron
co-adaption during training. The dropout operator randomly set (according to
the given dropout probability) the outputs of some units to zero, while others
are set equal to their corresponding inputs.</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>x</strong> &#8211; The input of dropout op.
Duplicable: False Optional: False</li>
<li><strong>dropout_prob</strong> (<em>FLOAT</em>) &#8211; Probability of setting units to zero.</li>
<li><strong>is_test</strong> (<em>BOOLEAN</em>) &#8211; True if in test phase.</li>
<li><strong>seed</strong> (<em>INT</em>) &#8211; Dropout random seed.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">The output of dropout op.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="reshape">
<h2>reshape<a class="headerlink" href="#reshape" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">reshape</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Reshape Operator.</p>
<p>Reshape Input(X) into the shape specified by Attr(shape).</p>
<p>An example:
Given a 2-D tensor X with 2 rows and 2 columns</p>
<blockquote>
<div>[[1, 2], [3, 4]]</div></blockquote>
<p>and target shape = [1, 4], the reshape operator will transform
the tensor X into a 1-D tensor:</p>
<blockquote>
<div>[1, 2, 3, 4]</div></blockquote>
<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>x</strong> &#8211; The input tensor of reshape operator.
Duplicable: False Optional: False</li>
<li><strong>shape</strong> (<em>INTS</em>) &#8211; (vector&lt;int&gt;) Target shape of reshape operator.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">The output tensor of reshape operator.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="sigmoid">
<h2>sigmoid<a class="headerlink" href="#sigmoid" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">sigmoid</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Sigmoid Activation Operator</p>
<p>$$y = frac{1}{1 + e^{-x}}$$</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"><strong>x</strong> &#8211; Input of Sigmoid operator
Duplicable: False Optional: False</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Output of Sigmoid operator</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="scale">
<h2>scale<a class="headerlink" href="#scale" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">scale</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Scale operator</p>
<p>$$Out = scale*X$$</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>x</strong> &#8211; (Tensor) Input tensor of scale operator.
Duplicable: False Optional: False</li>
<li><strong>scale</strong> (<em>FLOAT</em>) &#8211; (float, default 0)The scaling factor of the scale operator.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">(Tensor) Output tensor of scale operator.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="id1">
<h2>reshape<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">reshape</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Reshape Operator.</p>
<p>Reshape Input(X) into the shape specified by Attr(shape).</p>
<p>An example:
Given a 2-D tensor X with 2 rows and 2 columns</p>
<blockquote>
<div>[[1, 2], [3, 4]]</div></blockquote>
<p>and target shape = [1, 4], the reshape operator will transform
the tensor X into a 1-D tensor:</p>
<blockquote>
<div>[1, 2, 3, 4]</div></blockquote>
<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>x</strong> &#8211; The input tensor of reshape operator.
Duplicable: False Optional: False</li>
<li><strong>shape</strong> (<em>INTS</em>) &#8211; (vector&lt;int&gt;) Target shape of reshape operator.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">The output tensor of reshape operator.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="transpose">
<h2>transpose<a class="headerlink" href="#transpose" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">transpose</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Transpose Operator.</p>
<p>The input tensor will be permuted according to the axis values given.
The op functions similar to how numpy.transpose works in python.
For example:</p>
<blockquote>
<div><p>&gt;&gt; input = numpy.arange(6).reshape((2,3))
&gt;&gt; input
array([[0, 1, 2],</p>
<blockquote>
<div>[3, 4, 5]])</div></blockquote>
<p>&gt;&gt; axis = [1, 0]
&gt;&gt; output = input.transpose(axis)
&gt;&gt; output
array([[0, 3],</p>
<blockquote>
<div><dl class="docutils">
<dt>[1, 4],</dt>
<dd>[2, 5]])</dd>
</dl>
</div></blockquote>
</div></blockquote>
<p>So, given a input tensor of shape(N, C, H, W) and the axis is {0, 2, 3, 1},
the output tensor shape will be (N, H, W, C)</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>x</strong> &#8211; (Tensor)The input tensor, tensors with rank at most 6 are supported
Duplicable: False Optional: False</li>
<li><strong>axis</strong> (<em>INTS</em>) &#8211; (vector&lt;int&gt;)A list of values, and the size of the list should be the same with the input tensor rank, the tensor will permute the axes according the the values given</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">(Tensor)The output tensor</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="sigmoid-cross-entropy-with-logits">
<h2>sigmoid_cross_entropy_with_logits<a class="headerlink" href="#sigmoid-cross-entropy-with-logits" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="cast">
<h2>cast<a class="headerlink" href="#cast" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">cast</code><span class="sig-paren">(</span><em>x</em>, <em>dtype</em>, <em>main_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function takes in the input with input_dtype
and casts it to the output_dtype as the output.</p>
</dd></dl>
</div>
<div class="section" id="concat">
<h2>concat<a class="headerlink" href="#concat" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">concat</code><span class="sig-paren">(</span><em>input</em>, <em>axis</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function concats the input along the axis mentioned
and returns that as the output.</p>
</dd></dl>
</div>
<div class="section" id="sums">
<h2>sums<a class="headerlink" href="#sums" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">sums</code><span class="sig-paren">(</span><em>input</em>, <em>out=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function takes in the input and performs the sum operation on it
and returns that as the output.</p>
</dd></dl>
</div>
<div class="section" id="linear-chain-crf">
<h2>linear_chain_crf<a class="headerlink" href="#linear-chain-crf" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">linear_chain_crf</code><span class="sig-paren">(</span><em>input</em>, <em>label</em>, <em>param_attr=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="assign">
<h2>assign<a class="headerlink" href="#assign" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">embedding</code><span class="sig-paren">(</span><em>input</em>, <em>size</em>, <em>is_sparse=False</em>, <em>param_attr=None</em>, <em>dtype='float32'</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>Embedding Layer.</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 last simple">
<li><strong>param_initializer</strong> &#8211; </li>
<li><strong>input</strong> &#8211; The input to the function</li>
<li><strong>size</strong> &#8211; The size of the layer</li>
<li><strong>is_sparse</strong> &#8211; A flag that decleares whether the input is sparse</li>
<li><strong>param_attr</strong> &#8211; Parameters for this layer</li>
<li><strong>dtype</strong> &#8211; The type of data : float32, float_16, int etc</li>
<li><strong>main_program</strong> &#8211; Name of the main program that calls this</li>
<li><strong>startup_program</strong> &#8211; Name of the startup program</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This function can take in the input (which is a vector of IDs) and
performs a lookup in the lookup_table using these IDs, to result into
the embedding of each ID in the input.</p>
<p>All the input variables of this function are passed in as local variables
to the LayerHelper constructor.</p>
</dd></dl>
</div>
<div class="section" id="split-lod-tensor">
<h2>split_lod_tensor<a class="headerlink" href="#split-lod-tensor" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">split_lod_tensor</code><span class="sig-paren">(</span><em>input</em>, <em>mask</em>, <em>level=0</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="merge-lod-tensor">
<h2>merge_lod_tensor<a class="headerlink" href="#merge-lod-tensor" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">merge_lod_tensor</code><span class="sig-paren">(</span><em>in_true</em>, <em>in_false</em>, <em>x</em>, <em>mask</em>, <em>level=0</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="cos-sim">
<h2>cos_sim<a class="headerlink" href="#cos-sim" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">cos_sim</code><span class="sig-paren">(</span><em>X</em>, <em>Y</em>, <em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>This function performs the cosine similarity between two tensors
X and Y and returns that as the output.</p>
</dd></dl>
</div>
<div class="section" id="cross-entropy">
<h2>cross_entropy<a class="headerlink" href="#cross-entropy" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">cross_entropy</code><span class="sig-paren">(</span><em>input</em>, <em>label</em>, <em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>This function computes cross_entropy using the input and label.</p>
</dd></dl>
</div>
<div class="section" id="square-error-cost">
<h2>square_error_cost<a class="headerlink" href="#square-error-cost" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">square_error_cost</code><span class="sig-paren">(</span><em>input</em>, <em>label</em>, <em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>This functions returns the squared error cost using the input and label.
The output is appending the op to do the above.</p>
</dd></dl>
</div>
<div class="section" id="accuracy">
<h2>accuracy<a class="headerlink" href="#accuracy" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">accuracy</code><span class="sig-paren">(</span><em>input</em>, <em>label</em>, <em>k=1</em>, <em>correct=None</em>, <em>total=None</em>, <em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>This function computes the accuracy using the input and label.
The output is the top_k inputs and their indices.</p>
</dd></dl>
</div>
<div class="section" id="sequence-conv">
<h2>sequence_conv<a class="headerlink" href="#sequence-conv" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">sequence_conv</code><span class="sig-paren">(</span><em>input</em>, <em>num_filters</em>, <em>filter_size=3</em>, <em>filter_stride=1</em>, <em>padding=None</em>, <em>bias_attr=None</em>, <em>param_attr=None</em>, <em>act=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates the op for sequence_conv, using the inputs and
other convolutional configurations for the filters and stride as given
in the input parameters to the function.</p>
</dd></dl>
</div>
<div class="section" id="conv2d">
<h2>conv2d<a class="headerlink" href="#conv2d" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">conv2d</code><span class="sig-paren">(</span><em>input, num_filters, filter_size, stride=[1, 1], padding=None, groups=None, param_attr=None, bias_attr=None, act=None, name=None, main_program=None, startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates the op for a 2-dimensional Convolution.
This is performed using the parameters of filters(size, dimensionality etc)
, stride and other configurations for a Convolution operation.
This funciton can also append an activation on top of the
conv-2d output, if mentioned in the input parameters.</p>
</dd></dl>
</div>
<div class="section" id="sequence-pool">
<h2>sequence_pool<a class="headerlink" href="#sequence-pool" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">sequence_pool</code><span class="sig-paren">(</span><em>input</em>, <em>pool_type</em>, <em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>This function add the operator for sequence pooling.
This is applied on top of the input using pool_type mentioned
in the parameters.</p>
</dd></dl>
</div>
<div class="section" id="pool2d">
<h2>pool2d<a class="headerlink" href="#pool2d" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">pool2d</code><span class="sig-paren">(</span><em>input, pool_size, pool_type, pool_stride=[1, 1], pool_padding=[0, 0], global_pooling=False, main_program=None, startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function adds the operator for pooling in 2 dimensions, using the
pooling configurations mentioned in input parameters.</p>
</dd></dl>
</div>
<div class="section" id="batch-norm">
<h2>batch_norm<a class="headerlink" href="#batch-norm" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">batch_norm</code><span class="sig-paren">(</span><em>input</em>, <em>act=None</em>, <em>is_test=False</em>, <em>momentum=0.9</em>, <em>epsilon=1e-05</em>, <em>param_attr=None</em>, <em>bias_attr=None</em>, <em>data_layout='NCHW'</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function helps create an operator to implement
the BatchNorm layer using the configurations from the input parameters.</p>
</dd></dl>
</div>
<div class="section" id="beam-search-decode">
<h2>beam_search_decode<a class="headerlink" href="#beam-search-decode" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">beam_search_decode</code><span class="sig-paren">(</span><em>ids</em>, <em>scores</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="lstm">
<h2>lstm<a class="headerlink" href="#lstm" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">lstm</code><span class="sig-paren">(</span><em>x</em>, <em>c_pre_init</em>, <em>hidden_dim</em>, <em>forget_bias=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function helps create an operator for the LSTM (Long Short Term
Memory) cell that can be used inside an RNN.</p>
</dd></dl>
</div>
<div class="section" id="lod-rank-table">
<h2>lod_rank_table<a class="headerlink" href="#lod-rank-table" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">lod_rank_table</code><span class="sig-paren">(</span><em>x</em>, <em>level=0</em>, <em>main_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator for creating a LOD_RANK_TABLE
using the input x.</p>
</dd></dl>
</div>
<div class="section" id="max-sequence-len">
<h2>max_sequence_len<a class="headerlink" href="#max-sequence-len" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">max_sequence_len</code><span class="sig-paren">(</span><em>rank_table</em>, <em>main_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator to calculate the length of
max seqence through input rank_table(should be a lod_rank_table)</p>
</dd></dl>
</div>
<div class="section" id="topk">
<h2>topk<a class="headerlink" href="#topk" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">topk</code><span class="sig-paren">(</span><em>input</em>, <em>k</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="lod-tensor-to-array">
<h2>lod_tensor_to_array<a class="headerlink" href="#lod-tensor-to-array" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">lod_tensor_to_array</code><span class="sig-paren">(</span><em>x</em>, <em>table</em>, <em>main_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator to convert an LOD_Tensor to
an array.</p>
</dd></dl>
</div>
<div class="section" id="array-to-lod-tensor">
<h2>array_to_lod_tensor<a class="headerlink" href="#array-to-lod-tensor" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">array_to_lod_tensor</code><span class="sig-paren">(</span><em>x</em>, <em>table</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator to convert an array to a
LOD_Tensor.</p>
</dd></dl>
</div>
<div class="section" id="fill-constant">
<h2>fill_constant<a class="headerlink" href="#fill-constant" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">fill_constant</code><span class="sig-paren">(</span><em>shape</em>, <em>dtype</em>, <em>value</em>, <em>out=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates a tensor , with shape as mentioned in the input and
specified dtype and fills this up with a constant value that
comes in the input. It also sets the stop_gradient to be True.</p>
</dd></dl>
</div>
<div class="section" id="fill-constant-batch-size-like">
<h2>fill_constant_batch_size_like<a class="headerlink" href="#fill-constant-batch-size-like" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">fill_constant_batch_size_like</code><span class="sig-paren">(</span><em>input</em>, <em>shape</em>, <em>dtype</em>, <em>value</em>, <em>input_dim_idx=0</em>, <em>output_dim_idx=0</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="ones">
<h2>ones<a class="headerlink" href="#ones" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">ones</code><span class="sig-paren">(</span><em>shape</em>, <em>dtype</em>, <em>main_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function performs the same function as fill_constant() declared above
with the constant value being 1.0.</p>
</dd></dl>
</div>
<div class="section" id="zeros">
<h2>zeros<a class="headerlink" href="#zeros" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">zeros</code><span class="sig-paren">(</span><em>shape</em>, <em>dtype</em>, <em>main_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function performs the same function as fill_constant() declared above
with the constant value being 0.0.</p>
</dd></dl>
</div>
<div class="section" id="increment">
<h2>increment<a class="headerlink" href="#increment" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">increment</code><span class="sig-paren">(</span><em>x</em>, <em>value=1.0</em>, <em>in_place=True</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator to increment each value in the input
<cite>x</cite> by an amount: <cite>value</cite> as mentioned in the input parameter. This
operation is performed in-place by default.</p>
</dd></dl>
</div>
<div class="section" id="array-write">
<h2>array_write<a class="headerlink" href="#array-write" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">array_write</code><span class="sig-paren">(</span><em>x</em>, <em>i</em>, <em>array=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator to write the data out as a
LOD_TENSOR_ARRAY.</p>
</dd></dl>
</div>
<div class="section" id="create-array">
<h2>create_array<a class="headerlink" href="#create-array" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">create_array</code><span class="sig-paren">(</span><em>dtype</em>, <em>main_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="less-than">
<h2>less_than<a class="headerlink" href="#less-than" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">less_than</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>cond=None</em>, <em>main_program=None</em>, <em>**ignored</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="array-read">
<h2>array_read<a class="headerlink" href="#array-read" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">array_read</code><span class="sig-paren">(</span><em>array</em>, <em>i</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator to read the data in as a
LOD_TENSOR_ARRAY.</p>
</dd></dl>
</div>
<div class="section" id="shrink-memory">
<h2>shrink_memory<a class="headerlink" href="#shrink-memory" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">shrink_memory</code><span class="sig-paren">(</span><em>x</em>, <em>i</em>, <em>table</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator to shrink_rnn_memory using the RankTable
as mentioned in the input parameter.</p>
</dd></dl>
</div>
<div class="section" id="array-length">
<h2>array_length<a class="headerlink" href="#array-length" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">array_length</code><span class="sig-paren">(</span><em>array</em>, <em>main_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator to find the length of the
LOD_TENSOR_ARRAY.</p>
</dd></dl>
</div>
<div class="section" id="conv2d-transpose">
<h2>conv2d_transpose<a class="headerlink" href="#conv2d-transpose" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">conv2d_transpose</code><span class="sig-paren">(</span><em>input</em>, <em>num_filters</em>, <em>output_size=None</em>, <em>filter_size=None</em>, <em>padding=None</em>, <em>stride=None</em>, <em>param_attr=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>The transpose of conv2d layer.</p>
<p>This layer is also known as deconvolution layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>input</strong> (<em>Variable</em>) &#8211; The input image with [N, C, H, W] format.</li>
<li><strong>num_filters</strong> (<em>int</em>) &#8211; The number of filter. It is as same as the output
image channel.</li>
<li><strong>output_size</strong> (<em>int|tuple|None</em>) &#8211; The output image size. If output size is a
tuple, it must contain two integers, (image_H, image_W). This
parameter only works when filter_size is None.</li>
<li><strong>filter_size</strong> (<em>int|tuple|None</em>) &#8211; The filter size. If filter_size is a tuple,
it must contain two integers, (filter_size_H, filter_size_W).
Otherwise, the filter will be a square. None if use output size to
calculate filter_size</li>
<li><strong>padding</strong> (<em>int|tuple</em>) &#8211; The padding size. If padding is a tuple, it must
contain two integers, (padding_H, padding_W). Otherwise, the
padding_H = padding_W = padding.</li>
<li><strong>stride</strong> (<em>int|tuple</em>) &#8211; The stride size. If stride is a tuple, it must
contain two integers, (stride_H, stride_W). Otherwise, the
stride_H = stride_W = stride.</li>
<li><strong>param_attr</strong> &#8211; Parameter Attribute.</li>
<li><strong>main_program</strong> (<em>Program</em>) &#8211; the main program</li>
<li><strong>startup_program</strong> (<em>Program</em>) &#8211; the startup program</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Output image.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">Variable</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
......
......@@ -214,12 +214,28 @@
<h1>Nets<a class="headerlink" href="#nets" title="Permalink to this headline"></a></h1>
<div class="section" id="simple-img-conv-pool">
<h2>simple_img_conv_pool<a class="headerlink" href="#simple-img-conv-pool" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.nets.</code><code class="descname">simple_img_conv_pool</code><span class="sig-paren">(</span><em>input</em>, <em>num_filters</em>, <em>filter_size</em>, <em>pool_size</em>, <em>pool_stride</em>, <em>act</em>, <em>pool_type='max'</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="img-conv-group">
<h2>img_conv_group<a class="headerlink" href="#img-conv-group" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.nets.</code><code class="descname">img_conv_group</code><span class="sig-paren">(</span><em>input</em>, <em>conv_num_filter</em>, <em>pool_size</em>, <em>conv_padding=1</em>, <em>conv_filter_size=3</em>, <em>conv_act=None</em>, <em>conv_with_batchnorm=False</em>, <em>conv_batchnorm_drop_rate=None</em>, <em>pool_stride=1</em>, <em>pool_type=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>Image Convolution Group, Used for vgg net.</p>
</dd></dl>
</div>
<div class="section" id="sequence-conv-pool">
<h2>sequence_conv_pool<a class="headerlink" href="#sequence-conv-pool" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.nets.</code><code class="descname">sequence_conv_pool</code><span class="sig-paren">(</span><em>input</em>, <em>num_filters</em>, <em>filter_size</em>, <em>act='sigmoid'</em>, <em>pool_type='max'</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
</div>
......
......@@ -214,24 +214,105 @@
<h1>Optimizer<a class="headerlink" href="#optimizer" title="Permalink to this headline"></a></h1>
<div class="section" id="id1">
<h2>Optimizer<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.optimizer.</code><code class="descname">Optimizer</code><span class="sig-paren">(</span><em>global_step=None</em><span class="sig-paren">)</span></dt>
<dd><p>Optimizer Base class.</p>
<p>Define the common interface of an optimizer.
User should not use this class directly,
but need to use one of it&#8217;s implementation.</p>
<dl class="method">
<dt>
<code class="descname">create_optimization_pass</code><span class="sig-paren">(</span><em>parameters_and_grads</em>, <em>loss</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>Add optimization operators to update gradients to variables.</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>loss</strong> &#8211; the target that this optimization is for.</li>
<li><strong>parameters_and_grads</strong> &#8211; a list of (variable, gradient) pair to update.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a list of operators that will complete one step of
optimization. This will include parameter update ops, global step
update ops and any other custom ops required by subclasses to manage
their internal state.
:param startup_program:</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">return_op_list</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt>
<code class="descname">minimize</code><span class="sig-paren">(</span><em>loss</em>, <em>startup_program=None</em>, <em>parameter_list=None</em>, <em>no_grad_set=None</em><span class="sig-paren">)</span></dt>
<dd><p>Add operations to minimize <cite>loss</cite> by updating <cite>parameter_list</cite>.</p>
<p>This method combines interface <cite>append_backward_ops()</cite> and
<cite>create_optimization_pass()</cite> into one.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="sgdoptimizer">
<h2>SGDOptimizer<a class="headerlink" href="#sgdoptimizer" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.optimizer.</code><code class="descname">SGDOptimizer</code><span class="sig-paren">(</span><em>learning_rate</em>, <em>global_step=None</em><span class="sig-paren">)</span></dt>
<dd><p>Simple SGD optimizer without any state.</p>
</dd></dl>
</div>
<div class="section" id="momentumoptimizer">
<h2>MomentumOptimizer<a class="headerlink" href="#momentumoptimizer" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.optimizer.</code><code class="descname">MomentumOptimizer</code><span class="sig-paren">(</span><em>learning_rate</em>, <em>momentum</em>, <em>use_nesterov=False</em>, <em>global_step=None</em><span class="sig-paren">)</span></dt>
<dd><p>Simple Momentum optimizer with velocity state</p>
</dd></dl>
</div>
<div class="section" id="adagradoptimizer">
<h2>AdagradOptimizer<a class="headerlink" href="#adagradoptimizer" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.optimizer.</code><code class="descname">AdagradOptimizer</code><span class="sig-paren">(</span><em>learning_rate</em>, <em>epsilon=1e-06</em>, <em>global_step=None</em><span class="sig-paren">)</span></dt>
<dd><p>Simple Adagrad optimizer with moment state</p>
</dd></dl>
</div>
<div class="section" id="adamoptimizer">
<h2>AdamOptimizer<a class="headerlink" href="#adamoptimizer" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.optimizer.</code><code class="descname">AdamOptimizer</code><span class="sig-paren">(</span><em>learning_rate=0.001</em>, <em>beta1=0.9</em>, <em>beta2=0.999</em>, <em>epsilon=1e-08</em>, <em>global_step=None</em><span class="sig-paren">)</span></dt>
<dd><p>Implements the Adam Optimizer</p>
</dd></dl>
</div>
<div class="section" id="adamaxoptimizer">
<h2>AdamaxOptimizer<a class="headerlink" href="#adamaxoptimizer" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.optimizer.</code><code class="descname">AdamaxOptimizer</code><span class="sig-paren">(</span><em>learning_rate=0.001</em>, <em>beta1=0.9</em>, <em>beta2=0.999</em>, <em>epsilon=1e-08</em>, <em>global_step=None</em><span class="sig-paren">)</span></dt>
<dd><p>Implements the Adamax Optimizer</p>
</dd></dl>
</div>
<div class="section" id="decayedadagradoptimizer">
<h2>DecayedAdagradOptimizer<a class="headerlink" href="#decayedadagradoptimizer" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.optimizer.</code><code class="descname">DecayedAdagradOptimizer</code><span class="sig-paren">(</span><em>learning_rate</em>, <em>decay=0.95</em>, <em>epsilon=1e-06</em>, <em>global_step=None</em><span class="sig-paren">)</span></dt>
<dd><p>Simple Decayed Adagrad optimizer with moment state</p>
</dd></dl>
</div>
</div>
......
......@@ -214,6 +214,35 @@
<h1>Profiler<a class="headerlink" href="#profiler" title="Permalink to this headline"></a></h1>
<div class="section" id="id1">
<h2>Profiler<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.profiler.</code><code class="descname">cuda_profiler</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwds</em><span class="sig-paren">)</span></dt>
<dd><p>The CUDA profiler.
This fuctions is used to profile CUDA program by CUDA runtime application
programming interface. The profiling result will be written into
<cite>output_file</cite> with Key-Value pair format or Comma separated values format.
The user can set the output mode by <cite>output_mode</cite> argument and set the
counters/options for profiling by <cite>config</cite> argument. The default config
is [&#8216;gpustarttimestamp&#8217;, &#8216;gpustarttimestamp&#8217;, &#8216;gridsize3d&#8217;,
&#8216;threadblocksize&#8217;, &#8216;streamid&#8217;, &#8216;enableonstart 0&#8217;, &#8216;conckerneltrace&#8217;].</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 last simple">
<li><strong>output_file</strong> (<em>string</em>) &#8211; The output file name, the result will be
written into this file.</li>
<li><strong>output_mode</strong> (<em>string</em>) &#8211; The output mode has Key-Value pair format and
Comma separated values format. It should be &#8216;kvp&#8217; or &#8216;csv&#8217;.</li>
<li><strong>config</strong> (<em>string</em>) &#8211; The profiler options and counters can refer to
&#8220;Compute Command Line Profiler User Guide&#8221;.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
......
......@@ -214,12 +214,36 @@
<h1>Regularizer<a class="headerlink" href="#regularizer" title="Permalink to this headline"></a></h1>
<div class="section" id="weightdecayregularizer">
<h2>WeightDecayRegularizer<a class="headerlink" href="#weightdecayregularizer" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.regularizer.</code><code class="descname">WeightDecayRegularizer</code></dt>
<dd><p>Base class for weight decay regularizers</p>
<p>Defines the common interface of weight-decay regularizers.
Weight-decay regularizers are added only during the backward
pass for faster regularization. They add operations to the network
that correspond to gradient of the regularization function.
Users should not use this class directly, but need to use one
of its implementations</p>
</dd></dl>
</div>
<div class="section" id="l2decayregularizer">
<h2>L2DecayRegularizer<a class="headerlink" href="#l2decayregularizer" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.regularizer.</code><code class="descname">L2DecayRegularizer</code><span class="sig-paren">(</span><em>regularization_coeff=0.0</em><span class="sig-paren">)</span></dt>
<dd><p>Implements the L2 Weight Decay Regularization</p>
</dd></dl>
</div>
<div class="section" id="l1decayregularizer">
<h2>L1DecayRegularizer<a class="headerlink" href="#l1decayregularizer" title="Permalink to this headline"></a></h2>
<span class="target" id="module-paddle.v2.fluid.regularizer"></span><dl class="class">
<dt id="paddle.v2.fluid.regularizer.L1DecayRegularizer">
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.regularizer.</code><code class="descname">L1DecayRegularizer</code><span class="sig-paren">(</span><em>regularization_coeff=0.0</em><span class="sig-paren">)</span><a class="headerlink" href="#paddle.v2.fluid.regularizer.L1DecayRegularizer" title="Permalink to this definition"></a></dt>
<dd><p>Implements the L1 Weight Decay Regularization</p>
</dd></dl>
</div>
</div>
......
......@@ -211,6 +211,7 @@
<a href="#B"><strong>B</strong></a>
| <a href="#C"><strong>C</strong></a>
| <a href="#L"><strong>L</strong></a>
| <a href="#M"><strong>M</strong></a>
| <a href="#P"><strong>P</strong></a>
| <a href="#R"><strong>R</strong></a>
| <a href="#S"><strong>S</strong></a>
......@@ -236,12 +237,14 @@
<h2 id="L">L</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/v2/data/image.html#paddle.v2.image.left_right_flip">left_right_flip() (in module paddle.v2.image)</a>
<li><a href="api/v2/fluid/regularizer.html#paddle.v2.fluid.regularizer.L1DecayRegularizer">L1DecayRegularizer (class in paddle.v2.fluid.regularizer)</a>
</li>
<li><a href="api/v2/data/image.html#paddle.v2.image.load_and_transform">load_and_transform() (in module paddle.v2.image)</a>
<li><a href="api/v2/data/image.html#paddle.v2.image.left_right_flip">left_right_flip() (in module paddle.v2.image)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/v2/data/image.html#paddle.v2.image.load_and_transform">load_and_transform() (in module paddle.v2.image)</a>
</li>
<li><a href="api/v2/data/image.html#paddle.v2.image.load_image">load_image() (in module paddle.v2.image)</a>
</li>
<li><a href="api/v2/data/image.html#paddle.v2.image.load_image_bytes">load_image_bytes() (in module paddle.v2.image)</a>
......@@ -249,13 +252,23 @@
</ul></td>
</tr></table>
<h2 id="M">M</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/v2/fluid/evaluator.html#paddle.v2.fluid.evaluator.Evaluator.metrics">metrics (paddle.v2.fluid.evaluator.Evaluator attribute)</a>
</li>
</ul></td>
</tr></table>
<h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/v2/data/image.html#module-paddle.v2.image">paddle.v2.image (module)</a>
<li><a href="api/v2/fluid/regularizer.html#module-paddle.v2.fluid.regularizer">paddle.v2.fluid.regularizer (module)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/v2/data/image.html#module-paddle.v2.image">paddle.v2.image (module)</a>
</li>
<li><a href="api/v1/data_provider/pydataprovider2_en.html#paddle.trainer.PyDataProvider2.provider">provider() (in module paddle.trainer.PyDataProvider2)</a>
</li>
</ul></td>
......@@ -277,6 +290,10 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/v2/data/image.html#paddle.v2.image.simple_transform">simple_transform() (in module paddle.v2.image)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/v2/fluid/evaluator.html#paddle.v2.fluid.evaluator.Evaluator.states">states (paddle.v2.fluid.evaluator.Evaluator attribute)</a>
</li>
</ul></td>
</tr></table>
......
......@@ -223,6 +223,11 @@
<td>
<code class="xref">paddle</code></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="api/v2/fluid/regularizer.html#module-paddle.v2.fluid.regularizer"><code class="xref">paddle.v2.fluid.regularizer</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -208,6 +208,75 @@
<h1>Evaluator<a class="headerlink" href="#evaluator" title="永久链接至标题"></a></h1>
<div class="section" id="id1">
<h2>Evaluator<a class="headerlink" href="#id1" title="永久链接至标题"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.evaluator.</code><code class="descname">Evaluator</code><span class="sig-paren">(</span><em>name</em>, <em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Base Class for all evaluators</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 last simple">
<li><strong>name</strong> (<em>str</em>) &#8211; The name of evaluator. such as, &#8220;accuracy&#8221;. Used for generate
temporary variable name.</li>
<li><strong>main_program</strong> (<em>Program</em><em>, </em><em>optional</em>) &#8211; The evaluator should be added to this
main_program. Default default_main_program()</li>
<li><strong>startup_program</strong> (<em>Program</em><em>, </em><em>optional</em>) &#8211; The parameter should be added to this
startup_program. Default default_startup_program()</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="paddle.v2.fluid.evaluator.Evaluator.states">
<code class="descname">states</code><a class="headerlink" href="#paddle.v2.fluid.evaluator.Evaluator.states" title="永久链接至目标"></a></dt>
<dd><p><em>list</em> &#8211; The list of state variables. states will be reset to zero
when <cite>reset</cite> is invoked.</p>
</dd></dl>
<dl class="attribute">
<dt id="paddle.v2.fluid.evaluator.Evaluator.metrics">
<code class="descname">metrics</code><a class="headerlink" href="#paddle.v2.fluid.evaluator.Evaluator.metrics" title="永久链接至目标"></a></dt>
<dd><p><em>list</em> &#8211; The list of metrics variables. They will be calculate
every mini-batch</p>
</dd></dl>
<dl class="method">
<dt>
<code class="descname">reset</code><span class="sig-paren">(</span><em>executor</em>, <em>reset_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>reset metric states at the begin of each pass/user specified batch</p>
</dd></dl>
<dl class="method">
<dt>
<code class="descname">eval</code><span class="sig-paren">(</span><em>executor</em>, <em>eval_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>Evaluate the statistics merged by multiple mini-batches.</p>
</dd></dl>
<dl class="method">
<dt>
<code class="descname">create_state</code><span class="sig-paren">(</span><em>suffix</em>, <em>dtype</em>, <em>shape</em><span class="sig-paren">)</span></dt>
<dd><p>Create state variable.</p>
<p>NOTE: It is not a public API.</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 last simple">
<li><strong>suffix</strong> (<em>str</em>) &#8211; the state suffix.</li>
<li><strong>dtype</strong> (<em>str|core.DataType</em>) &#8211; the state data type</li>
<li><strong>shape</strong> (<em>tuple|list</em>) &#8211; the shape of state</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns: State variable</p>
</dd></dl>
</dd></dl>
</div>
</div>
......
......@@ -208,21 +208,90 @@
<h1>Initializer<a class="headerlink" href="#initializer" title="永久链接至标题"></a></h1>
<div class="section" id="id1">
<h2>Initializer<a class="headerlink" href="#id1" title="永久链接至标题"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.initializer.</code><code class="descname">Initializer</code></dt>
<dd><p>Base class for variable initializers</p>
<p>Defines the common interface of variable initializers.
They add operations to the init program that are used
to initialize variables. Users should not use this class
directly, but need to use one of its implementations.</p>
</dd></dl>
</div>
<div class="section" id="constantinitializer">
<h2>ConstantInitializer<a class="headerlink" href="#constantinitializer" title="永久链接至标题"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.initializer.</code><code class="descname">ConstantInitializer</code><span class="sig-paren">(</span><em>value=0.0</em><span class="sig-paren">)</span></dt>
<dd><p>Implements the constant initializer</p>
</dd></dl>
</div>
<div class="section" id="uniforminitializer">
<h2>UniformInitializer<a class="headerlink" href="#uniforminitializer" title="永久链接至标题"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.initializer.</code><code class="descname">UniformInitializer</code><span class="sig-paren">(</span><em>low=-1.0</em>, <em>high=1.0</em>, <em>seed=0</em><span class="sig-paren">)</span></dt>
<dd><p>Implements the random uniform distribution initializer</p>
</dd></dl>
</div>
<div class="section" id="normalinitializer">
<h2>NormalInitializer<a class="headerlink" href="#normalinitializer" title="永久链接至标题"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.initializer.</code><code class="descname">NormalInitializer</code><span class="sig-paren">(</span><em>loc=0.0</em>, <em>scale=1.0</em>, <em>seed=0</em><span class="sig-paren">)</span></dt>
<dd><p>Implements the random Normal(Gaussian) distribution initializer</p>
</dd></dl>
</div>
<div class="section" id="xavierinitializer">
<h2>XavierInitializer<a class="headerlink" href="#xavierinitializer" title="永久链接至标题"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.initializer.</code><code class="descname">XavierInitializer</code><span class="sig-paren">(</span><em>uniform=True</em>, <em>fan_in=None</em>, <em>fan_out=None</em>, <em>seed=0</em><span class="sig-paren">)</span></dt>
<dd><p>Implements the Xavier initializer</p>
<p>This class implements the Xavier weight initializer from the paper
Understanding the difficulty of training deep feedforward neural
networks[1] by Xavier Glorot and Yoshua Bengio.</p>
<p>This initializer is designed to keep the scale of the gradients
approximately same in all the layers. In case of Uniform distribution,
the range is [-x, x], where x = sqrt(6 / (fan_in + fan_out)).
In case of Normal distribution, the mean is 0 and the standard deviation
is sqrt(2/ (fan_in + fan_out)).</p>
<p class="rubric">References</p>
<dl class="docutils">
<dt>[1] Understanding the difficulty of training deep feedforward neural</dt>
<dd>networks. International conference on artificial intelligence and
statistics.
(<a class="reference external" href="http://proceedings.mlr.press/v9/glorot10a.html">http://proceedings.mlr.press/v9/glorot10a.html</a>)</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="msrainitializer">
<h2>MSRAInitializer<a class="headerlink" href="#msrainitializer" title="永久链接至标题"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.initializer.</code><code class="descname">MSRAInitializer</code><span class="sig-paren">(</span><em>uniform=True</em>, <em>fan_in=None</em>, <em>seed=0</em><span class="sig-paren">)</span></dt>
<dd><p>Implements the MSRA initializer a.k.a. Kaiming Initializer</p>
<p>This class implements the weight initialization from the paper
Delving Deep into Rectifiers: Surpassing Human-Level Performance on
ImageNet Classification[1] by Kaiming He, Xiangyu Zhang, Shaoqing Ren
and Jian Sun. This is a robust initialization method that particularly
considers the rectifier nonlinearities. In case of Uniform distribution,
the range is [-x, x], where x = sqrt(6 / fan_in). In case of Normal
distribution, the mean is 0 and the standard deviation
is sqrt(2/ fan_in).</p>
<p class="rubric">References</p>
<dl class="docutils">
<dt>[1] Delving Deep into Rectifiers: Surpassing Human-Level Performance</dt>
<dd>on ImageNet Classification
(<a class="reference external" href="https://arxiv.org/abs/1502.01852">https://arxiv.org/abs/1502.01852</a>)</dd>
</dl>
</dd></dl>
</div>
</div>
......
......@@ -208,153 +208,859 @@
<h1>Layers<a class="headerlink" href="#layers" title="永久链接至标题"></a></h1>
<div class="section" id="fc">
<h2>fc<a class="headerlink" href="#fc" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">fc</code><span class="sig-paren">(</span><em>input</em>, <em>size</em>, <em>num_flatten_dims=1</em>, <em>param_attr=None</em>, <em>bias_attr=None</em>, <em>act=None</em>, <em>name=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>Fully Connected Layer.</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 last simple">
<li><strong>input</strong> &#8211; The input tensor to the function</li>
<li><strong>size</strong> &#8211; The size of the layer</li>
<li><strong>num_flatten_dims</strong> &#8211; Number of columns in input</li>
<li><strong>param_attr</strong> &#8211; The parameters/weights to the FC Layer</li>
<li><strong>param_initializer</strong> &#8211; Initializer used for the weight/parameter. If None, XavierInitializer() is used</li>
<li><strong>bias_attr</strong> &#8211; The bias parameter for the FC layer</li>
<li><strong>bias_initializer</strong> &#8211; Initializer used for the bias. If None, then ConstantInitializer() is used</li>
<li><strong>act</strong> &#8211; Activation to be applied to the output of FC layer</li>
<li><strong>name</strong> &#8211; Name/alias of the function</li>
<li><strong>main_program</strong> &#8211; Name of the main program that calls this</li>
<li><strong>startup_program</strong> &#8211; Name of the startup program</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This function can take in multiple inputs and performs the Fully Connected
function (linear transformation) on top of each of them.
So for input x, the output will be : Wx + b. Where W is the parameter,
b the bias and x is the input.</p>
<p>The function also applies an activation (non-linearity) on top of the
output, if activation is passed in the input.</p>
<p>All the input variables of this function are passed in as local variables
to the LayerHelper constructor.</p>
</dd></dl>
</div>
<div class="section" id="embedding">
<h2>embedding<a class="headerlink" href="#embedding" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">embedding</code><span class="sig-paren">(</span><em>input</em>, <em>size</em>, <em>is_sparse=False</em>, <em>param_attr=None</em>, <em>dtype='float32'</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>Embedding Layer.</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 last simple">
<li><strong>param_initializer</strong> &#8211; </li>
<li><strong>input</strong> &#8211; The input to the function</li>
<li><strong>size</strong> &#8211; The size of the layer</li>
<li><strong>is_sparse</strong> &#8211; A flag that decleares whether the input is sparse</li>
<li><strong>param_attr</strong> &#8211; Parameters for this layer</li>
<li><strong>dtype</strong> &#8211; The type of data : float32, float_16, int etc</li>
<li><strong>main_program</strong> &#8211; Name of the main program that calls this</li>
<li><strong>startup_program</strong> &#8211; Name of the startup program</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This function can take in the input (which is a vector of IDs) and
performs a lookup in the lookup_table using these IDs, to result into
the embedding of each ID in the input.</p>
<p>All the input variables of this function are passed in as local variables
to the LayerHelper constructor.</p>
</dd></dl>
</div>
<div class="section" id="dynamic-lstm">
<h2>dynamic_lstm<a class="headerlink" href="#dynamic-lstm" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">dynamic_lstm</code><span class="sig-paren">(</span><em>input</em>, <em>size</em>, <em>param_attr=None</em>, <em>bias_attr=None</em>, <em>use_peepholes=True</em>, <em>is_reverse=False</em>, <em>gate_activation='sigmoid'</em>, <em>cell_activation='tanh'</em>, <em>candidate_activation='tanh'</em>, <em>dtype='float32'</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="data">
<h2>data<a class="headerlink" href="#data" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">data</code><span class="sig-paren">(</span><em>name</em>, <em>shape</em>, <em>append_batch_size=True</em>, <em>dtype='float32'</em>, <em>lod_level=0</em>, <em>type=VarType.LOD_TENSOR</em>, <em>main_program=None</em>, <em>startup_program=None</em>, <em>stop_gradient=True</em><span class="sig-paren">)</span></dt>
<dd><p>Data Layer.</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 last simple">
<li><strong>name</strong> &#8211; The name/alias of the function</li>
<li><strong>shape</strong> &#8211; Tuple declaring the shape.</li>
<li><strong>append_batch_size</strong> &#8211; Whether or not to append the data as a batch.</li>
<li><strong>dtype</strong> &#8211; The type of data : float32, float_16, int etc</li>
<li><strong>type</strong> &#8211; The output type. By default it is LOD_TENSOR.</li>
<li><strong>lod_level</strong> (<em>int</em>) &#8211; The LoD Level. 0 means the input data is not a sequence.</li>
<li><strong>main_program</strong> &#8211; Name of the main program that calls this</li>
<li><strong>startup_program</strong> &#8211; Name of the startup program</li>
<li><strong>stop_gradient</strong> &#8211; A boolean that mentions whether gradient should flow.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This function takes in input and based on whether data has
to be returned back as a minibatch, it creates the global variable using
the helper functions. The global variables can be accessed by all the
following operations and layers in the graph.</p>
<p>All the input variables of this function are passed in as local variables
to the LayerHelper constructor.</p>
</dd></dl>
</div>
<div class="section" id="mean">
<h2>mean<a class="headerlink" href="#mean" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">mean</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Mean Operator.</p>
<p>Out is a scalar which is the mean of all elements in X.</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"><strong>x</strong> &#8211; The input of mean op
Duplicable: False Optional: False</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body">The output of mean op</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="mul">
<h2>mul<a class="headerlink" href="#mul" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">mul</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Mul Operator.</p>
<p>This operator is used to perform matrix multiplication for input X and Y.</p>
<p>The equation is:</p>
<blockquote>
<div>$$Out = X * Y$$</div></blockquote>
<p>Both the input <cite>X</cite> and <cite>Y</cite> can carry the LoD (Level of Details) information,
or not. But the output only shares the LoD information with input <cite>X</cite>.</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>x</strong> &#8211; The first input of mul op
Duplicable: False Optional: False</li>
<li><strong>y</strong> &#8211; The second input of mul op
Duplicable: False Optional: False</li>
<li><strong>x_num_col_dims</strong> (<em>INT</em>) &#8211; (int, default 1) mul_op can take tensors with more than two dimensions as input <cite>X</cite>,
in that case, tensors will be reshaped to a matrix. The matrix&#8217;s first
dimension(column length) will be the product of tensor&#8217;s last
<cite>num_col_dims</cite> dimensions, and the matrix&#8217;s second dimension(row length)
will be the product of tensor&#8217;s first <cite>rank - num_col_dims</cite> dimensions.</li>
<li><strong>y_num_col_dims</strong> (<em>INT</em>) &#8211; (int, default 1) mul_op can take tensors with more than two dimensions as input <cite>Y</cite>,
in that case, tensors will be reshaped to a matrix. Just like input <cite>X</cite>.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first last">The output of mul op</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="elementwise-add">
<h2>elementwise_add<a class="headerlink" href="#elementwise-add" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">elementwise_add</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Limited Elementwise Add Operator.</p>
<p>The equation is:</p>
<p>$Out = X + Y$</p>
<p>X is a tensor of any dimension and the dimensions of tensor Y must be smaller than
or equal to the dimensions of X.</p>
<p>There are two cases for this operator:
1. The shape of Y is same with X;
2. The shape of Y is a subset of X.</p>
<p>For case 2:
Y will be broadcasted to match the shape of X and axis should be
the starting dimension index for broadcasting Y onto X.</p>
<p class="rubric">example</p>
<p>shape(X) = (2, 3, 4, 5), shape(Y) = (,)
shape(X) = (2, 3, 4, 5), shape(Y) = (5,)
shape(X) = (2, 3, 4, 5), shape(Y) = (4, 5)
shape(X) = (2, 3, 4, 5), shape(Y) = (3, 4), with axis=1
shape(X) = (2, 3, 4, 5), shape(Y) = (2), with axis=0</p>
<p>Both the input X and Y can carry the LoD (Level of Details) information,
or not. But the output only shares the LoD information with input X.</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>x</strong> &#8211; (Tensor) The first input tensor of elementwise op
Duplicable: False Optional: False</li>
<li><strong>y</strong> &#8211; (Tensor) The second input tensor of elementwise op
Duplicable: False Optional: False</li>
<li><strong>axis</strong> (<em>INT</em>) &#8211; (int, default -1) The starting dimension index for broadcasting Y onto X</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first last">The output of elementwise op</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="elementwise-div">
<h2>elementwise_div<a class="headerlink" href="#elementwise-div" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">elementwise_div</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Limited Elementwise Div Operator.</p>
<p>The equation is:</p>
<p>$Out = X / Y$</p>
<p>X is a tensor of any dimension and the dimensions of tensor Y must be smaller than
or equal to the dimensions of X.</p>
<p>There are two cases for this operator:
1. The shape of Y is same with X;
2. The shape of Y is a subset of X.</p>
<p>For case 2:
Y will be broadcasted to match the shape of X and axis should be
the starting dimension index for broadcasting Y onto X.</p>
<p class="rubric">example</p>
<p>shape(X) = (2, 3, 4, 5), shape(Y) = (,)
shape(X) = (2, 3, 4, 5), shape(Y) = (5,)
shape(X) = (2, 3, 4, 5), shape(Y) = (4, 5)
shape(X) = (2, 3, 4, 5), shape(Y) = (3, 4), with axis=1
shape(X) = (2, 3, 4, 5), shape(Y) = (2), with axis=0</p>
<p>Both the input X and Y can carry the LoD (Level of Details) information,
or not. But the output only shares the LoD information with input X.</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>x</strong> &#8211; (Tensor) The first input tensor of elementwise op
Duplicable: False Optional: False</li>
<li><strong>y</strong> &#8211; (Tensor) The second input tensor of elementwise op
Duplicable: False Optional: False</li>
<li><strong>axis</strong> (<em>INT</em>) &#8211; (int, default -1) The starting dimension index for broadcasting Y onto X</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first last">The output of elementwise op</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="dropout">
<h2>dropout<a class="headerlink" href="#dropout" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">dropout</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Dropout Operator.</p>
<p>Dropout refers to randomly dropping out units in a nerual network. It is a
regularization technique for reducing overfitting by preventing neuron
co-adaption during training. The dropout operator randomly set (according to
the given dropout probability) the outputs of some units to zero, while others
are set equal to their corresponding inputs.</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>x</strong> &#8211; The input of dropout op.
Duplicable: False Optional: False</li>
<li><strong>dropout_prob</strong> (<em>FLOAT</em>) &#8211; Probability of setting units to zero.</li>
<li><strong>is_test</strong> (<em>BOOLEAN</em>) &#8211; True if in test phase.</li>
<li><strong>seed</strong> (<em>INT</em>) &#8211; Dropout random seed.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first last">The output of dropout op.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="reshape">
<h2>reshape<a class="headerlink" href="#reshape" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">reshape</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Reshape Operator.</p>
<p>Reshape Input(X) into the shape specified by Attr(shape).</p>
<p>An example:
Given a 2-D tensor X with 2 rows and 2 columns</p>
<blockquote>
<div>[[1, 2], [3, 4]]</div></blockquote>
<p>and target shape = [1, 4], the reshape operator will transform
the tensor X into a 1-D tensor:</p>
<blockquote>
<div>[1, 2, 3, 4]</div></blockquote>
<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>x</strong> &#8211; The input tensor of reshape operator.
Duplicable: False Optional: False</li>
<li><strong>shape</strong> (<em>INTS</em>) &#8211; (vector&lt;int&gt;) Target shape of reshape operator.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first last">The output tensor of reshape operator.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="sigmoid">
<h2>sigmoid<a class="headerlink" href="#sigmoid" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">sigmoid</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Sigmoid Activation Operator</p>
<p>$$y = frac{1}{1 + e^{-x}}$$</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"><strong>x</strong> &#8211; Input of Sigmoid operator
Duplicable: False Optional: False</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body">Output of Sigmoid operator</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="scale">
<h2>scale<a class="headerlink" href="#scale" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">scale</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Scale operator</p>
<p>$$Out = scale*X$$</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>x</strong> &#8211; (Tensor) Input tensor of scale operator.
Duplicable: False Optional: False</li>
<li><strong>scale</strong> (<em>FLOAT</em>) &#8211; (float, default 0)The scaling factor of the scale operator.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first last">(Tensor) Output tensor of scale operator.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="id1">
<h2>reshape<a class="headerlink" href="#id1" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">reshape</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Reshape Operator.</p>
<p>Reshape Input(X) into the shape specified by Attr(shape).</p>
<p>An example:
Given a 2-D tensor X with 2 rows and 2 columns</p>
<blockquote>
<div>[[1, 2], [3, 4]]</div></blockquote>
<p>and target shape = [1, 4], the reshape operator will transform
the tensor X into a 1-D tensor:</p>
<blockquote>
<div>[1, 2, 3, 4]</div></blockquote>
<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>x</strong> &#8211; The input tensor of reshape operator.
Duplicable: False Optional: False</li>
<li><strong>shape</strong> (<em>INTS</em>) &#8211; (vector&lt;int&gt;) Target shape of reshape operator.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first last">The output tensor of reshape operator.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="transpose">
<h2>transpose<a class="headerlink" href="#transpose" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">transpose</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Transpose Operator.</p>
<p>The input tensor will be permuted according to the axis values given.
The op functions similar to how numpy.transpose works in python.
For example:</p>
<blockquote>
<div><p>&gt;&gt; input = numpy.arange(6).reshape((2,3))
&gt;&gt; input
array([[0, 1, 2],</p>
<blockquote>
<div>[3, 4, 5]])</div></blockquote>
<p>&gt;&gt; axis = [1, 0]
&gt;&gt; output = input.transpose(axis)
&gt;&gt; output
array([[0, 3],</p>
<blockquote>
<div><dl class="docutils">
<dt>[1, 4],</dt>
<dd>[2, 5]])</dd>
</dl>
</div></blockquote>
</div></blockquote>
<p>So, given a input tensor of shape(N, C, H, W) and the axis is {0, 2, 3, 1},
the output tensor shape will be (N, H, W, C)</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>x</strong> &#8211; (Tensor)The input tensor, tensors with rank at most 6 are supported
Duplicable: False Optional: False</li>
<li><strong>axis</strong> (<em>INTS</em>) &#8211; (vector&lt;int&gt;)A list of values, and the size of the list should be the same with the input tensor rank, the tensor will permute the axes according the the values given</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first last">(Tensor)The output tensor</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="sigmoid-cross-entropy-with-logits">
<h2>sigmoid_cross_entropy_with_logits<a class="headerlink" href="#sigmoid-cross-entropy-with-logits" title="永久链接至标题"></a></h2>
</div>
<div class="section" id="cast">
<h2>cast<a class="headerlink" href="#cast" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">cast</code><span class="sig-paren">(</span><em>x</em>, <em>dtype</em>, <em>main_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function takes in the input with input_dtype
and casts it to the output_dtype as the output.</p>
</dd></dl>
</div>
<div class="section" id="concat">
<h2>concat<a class="headerlink" href="#concat" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">concat</code><span class="sig-paren">(</span><em>input</em>, <em>axis</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function concats the input along the axis mentioned
and returns that as the output.</p>
</dd></dl>
</div>
<div class="section" id="sums">
<h2>sums<a class="headerlink" href="#sums" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">sums</code><span class="sig-paren">(</span><em>input</em>, <em>out=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function takes in the input and performs the sum operation on it
and returns that as the output.</p>
</dd></dl>
</div>
<div class="section" id="linear-chain-crf">
<h2>linear_chain_crf<a class="headerlink" href="#linear-chain-crf" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">linear_chain_crf</code><span class="sig-paren">(</span><em>input</em>, <em>label</em>, <em>param_attr=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="assign">
<h2>assign<a class="headerlink" href="#assign" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">embedding</code><span class="sig-paren">(</span><em>input</em>, <em>size</em>, <em>is_sparse=False</em>, <em>param_attr=None</em>, <em>dtype='float32'</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>Embedding Layer.</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 last simple">
<li><strong>param_initializer</strong> &#8211; </li>
<li><strong>input</strong> &#8211; The input to the function</li>
<li><strong>size</strong> &#8211; The size of the layer</li>
<li><strong>is_sparse</strong> &#8211; A flag that decleares whether the input is sparse</li>
<li><strong>param_attr</strong> &#8211; Parameters for this layer</li>
<li><strong>dtype</strong> &#8211; The type of data : float32, float_16, int etc</li>
<li><strong>main_program</strong> &#8211; Name of the main program that calls this</li>
<li><strong>startup_program</strong> &#8211; Name of the startup program</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This function can take in the input (which is a vector of IDs) and
performs a lookup in the lookup_table using these IDs, to result into
the embedding of each ID in the input.</p>
<p>All the input variables of this function are passed in as local variables
to the LayerHelper constructor.</p>
</dd></dl>
</div>
<div class="section" id="split-lod-tensor">
<h2>split_lod_tensor<a class="headerlink" href="#split-lod-tensor" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">split_lod_tensor</code><span class="sig-paren">(</span><em>input</em>, <em>mask</em>, <em>level=0</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="merge-lod-tensor">
<h2>merge_lod_tensor<a class="headerlink" href="#merge-lod-tensor" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">merge_lod_tensor</code><span class="sig-paren">(</span><em>in_true</em>, <em>in_false</em>, <em>x</em>, <em>mask</em>, <em>level=0</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="cos-sim">
<h2>cos_sim<a class="headerlink" href="#cos-sim" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">cos_sim</code><span class="sig-paren">(</span><em>X</em>, <em>Y</em>, <em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>This function performs the cosine similarity between two tensors
X and Y and returns that as the output.</p>
</dd></dl>
</div>
<div class="section" id="cross-entropy">
<h2>cross_entropy<a class="headerlink" href="#cross-entropy" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">cross_entropy</code><span class="sig-paren">(</span><em>input</em>, <em>label</em>, <em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>This function computes cross_entropy using the input and label.</p>
</dd></dl>
</div>
<div class="section" id="square-error-cost">
<h2>square_error_cost<a class="headerlink" href="#square-error-cost" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">square_error_cost</code><span class="sig-paren">(</span><em>input</em>, <em>label</em>, <em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>This functions returns the squared error cost using the input and label.
The output is appending the op to do the above.</p>
</dd></dl>
</div>
<div class="section" id="accuracy">
<h2>accuracy<a class="headerlink" href="#accuracy" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">accuracy</code><span class="sig-paren">(</span><em>input</em>, <em>label</em>, <em>k=1</em>, <em>correct=None</em>, <em>total=None</em>, <em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>This function computes the accuracy using the input and label.
The output is the top_k inputs and their indices.</p>
</dd></dl>
</div>
<div class="section" id="sequence-conv">
<h2>sequence_conv<a class="headerlink" href="#sequence-conv" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">sequence_conv</code><span class="sig-paren">(</span><em>input</em>, <em>num_filters</em>, <em>filter_size=3</em>, <em>filter_stride=1</em>, <em>padding=None</em>, <em>bias_attr=None</em>, <em>param_attr=None</em>, <em>act=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates the op for sequence_conv, using the inputs and
other convolutional configurations for the filters and stride as given
in the input parameters to the function.</p>
</dd></dl>
</div>
<div class="section" id="conv2d">
<h2>conv2d<a class="headerlink" href="#conv2d" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">conv2d</code><span class="sig-paren">(</span><em>input, num_filters, filter_size, stride=[1, 1], padding=None, groups=None, param_attr=None, bias_attr=None, act=None, name=None, main_program=None, startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates the op for a 2-dimensional Convolution.
This is performed using the parameters of filters(size, dimensionality etc)
, stride and other configurations for a Convolution operation.
This funciton can also append an activation on top of the
conv-2d output, if mentioned in the input parameters.</p>
</dd></dl>
</div>
<div class="section" id="sequence-pool">
<h2>sequence_pool<a class="headerlink" href="#sequence-pool" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">sequence_pool</code><span class="sig-paren">(</span><em>input</em>, <em>pool_type</em>, <em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>This function add the operator for sequence pooling.
This is applied on top of the input using pool_type mentioned
in the parameters.</p>
</dd></dl>
</div>
<div class="section" id="pool2d">
<h2>pool2d<a class="headerlink" href="#pool2d" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">pool2d</code><span class="sig-paren">(</span><em>input, pool_size, pool_type, pool_stride=[1, 1], pool_padding=[0, 0], global_pooling=False, main_program=None, startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function adds the operator for pooling in 2 dimensions, using the
pooling configurations mentioned in input parameters.</p>
</dd></dl>
</div>
<div class="section" id="batch-norm">
<h2>batch_norm<a class="headerlink" href="#batch-norm" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">batch_norm</code><span class="sig-paren">(</span><em>input</em>, <em>act=None</em>, <em>is_test=False</em>, <em>momentum=0.9</em>, <em>epsilon=1e-05</em>, <em>param_attr=None</em>, <em>bias_attr=None</em>, <em>data_layout='NCHW'</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function helps create an operator to implement
the BatchNorm layer using the configurations from the input parameters.</p>
</dd></dl>
</div>
<div class="section" id="beam-search-decode">
<h2>beam_search_decode<a class="headerlink" href="#beam-search-decode" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">beam_search_decode</code><span class="sig-paren">(</span><em>ids</em>, <em>scores</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="lstm">
<h2>lstm<a class="headerlink" href="#lstm" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">lstm</code><span class="sig-paren">(</span><em>x</em>, <em>c_pre_init</em>, <em>hidden_dim</em>, <em>forget_bias=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function helps create an operator for the LSTM (Long Short Term
Memory) cell that can be used inside an RNN.</p>
</dd></dl>
</div>
<div class="section" id="lod-rank-table">
<h2>lod_rank_table<a class="headerlink" href="#lod-rank-table" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">lod_rank_table</code><span class="sig-paren">(</span><em>x</em>, <em>level=0</em>, <em>main_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator for creating a LOD_RANK_TABLE
using the input x.</p>
</dd></dl>
</div>
<div class="section" id="max-sequence-len">
<h2>max_sequence_len<a class="headerlink" href="#max-sequence-len" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">max_sequence_len</code><span class="sig-paren">(</span><em>rank_table</em>, <em>main_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator to calculate the length of
max seqence through input rank_table(should be a lod_rank_table)</p>
</dd></dl>
</div>
<div class="section" id="topk">
<h2>topk<a class="headerlink" href="#topk" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">topk</code><span class="sig-paren">(</span><em>input</em>, <em>k</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="lod-tensor-to-array">
<h2>lod_tensor_to_array<a class="headerlink" href="#lod-tensor-to-array" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">lod_tensor_to_array</code><span class="sig-paren">(</span><em>x</em>, <em>table</em>, <em>main_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator to convert an LOD_Tensor to
an array.</p>
</dd></dl>
</div>
<div class="section" id="array-to-lod-tensor">
<h2>array_to_lod_tensor<a class="headerlink" href="#array-to-lod-tensor" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">array_to_lod_tensor</code><span class="sig-paren">(</span><em>x</em>, <em>table</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator to convert an array to a
LOD_Tensor.</p>
</dd></dl>
</div>
<div class="section" id="fill-constant">
<h2>fill_constant<a class="headerlink" href="#fill-constant" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">fill_constant</code><span class="sig-paren">(</span><em>shape</em>, <em>dtype</em>, <em>value</em>, <em>out=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates a tensor , with shape as mentioned in the input and
specified dtype and fills this up with a constant value that
comes in the input. It also sets the stop_gradient to be True.</p>
</dd></dl>
</div>
<div class="section" id="fill-constant-batch-size-like">
<h2>fill_constant_batch_size_like<a class="headerlink" href="#fill-constant-batch-size-like" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">fill_constant_batch_size_like</code><span class="sig-paren">(</span><em>input</em>, <em>shape</em>, <em>dtype</em>, <em>value</em>, <em>input_dim_idx=0</em>, <em>output_dim_idx=0</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="ones">
<h2>ones<a class="headerlink" href="#ones" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">ones</code><span class="sig-paren">(</span><em>shape</em>, <em>dtype</em>, <em>main_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function performs the same function as fill_constant() declared above
with the constant value being 1.0.</p>
</dd></dl>
</div>
<div class="section" id="zeros">
<h2>zeros<a class="headerlink" href="#zeros" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">zeros</code><span class="sig-paren">(</span><em>shape</em>, <em>dtype</em>, <em>main_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function performs the same function as fill_constant() declared above
with the constant value being 0.0.</p>
</dd></dl>
</div>
<div class="section" id="increment">
<h2>increment<a class="headerlink" href="#increment" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">increment</code><span class="sig-paren">(</span><em>x</em>, <em>value=1.0</em>, <em>in_place=True</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator to increment each value in the input
<cite>x</cite> by an amount: <cite>value</cite> as mentioned in the input parameter. This
operation is performed in-place by default.</p>
</dd></dl>
</div>
<div class="section" id="array-write">
<h2>array_write<a class="headerlink" href="#array-write" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">array_write</code><span class="sig-paren">(</span><em>x</em>, <em>i</em>, <em>array=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator to write the data out as a
LOD_TENSOR_ARRAY.</p>
</dd></dl>
</div>
<div class="section" id="create-array">
<h2>create_array<a class="headerlink" href="#create-array" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">create_array</code><span class="sig-paren">(</span><em>dtype</em>, <em>main_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="less-than">
<h2>less_than<a class="headerlink" href="#less-than" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">less_than</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>cond=None</em>, <em>main_program=None</em>, <em>**ignored</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="array-read">
<h2>array_read<a class="headerlink" href="#array-read" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">array_read</code><span class="sig-paren">(</span><em>array</em>, <em>i</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator to read the data in as a
LOD_TENSOR_ARRAY.</p>
</dd></dl>
</div>
<div class="section" id="shrink-memory">
<h2>shrink_memory<a class="headerlink" href="#shrink-memory" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">shrink_memory</code><span class="sig-paren">(</span><em>x</em>, <em>i</em>, <em>table</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator to shrink_rnn_memory using the RankTable
as mentioned in the input parameter.</p>
</dd></dl>
</div>
<div class="section" id="array-length">
<h2>array_length<a class="headerlink" href="#array-length" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">array_length</code><span class="sig-paren">(</span><em>array</em>, <em>main_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>This function creates an operator to find the length of the
LOD_TENSOR_ARRAY.</p>
</dd></dl>
</div>
<div class="section" id="conv2d-transpose">
<h2>conv2d_transpose<a class="headerlink" href="#conv2d-transpose" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">conv2d_transpose</code><span class="sig-paren">(</span><em>input</em>, <em>num_filters</em>, <em>output_size=None</em>, <em>filter_size=None</em>, <em>padding=None</em>, <em>stride=None</em>, <em>param_attr=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>The transpose of conv2d layer.</p>
<p>This layer is also known as deconvolution layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">参数:</th><td class="field-body"><ul class="first simple">
<li><strong>input</strong> (<em>Variable</em>) &#8211; The input image with [N, C, H, W] format.</li>
<li><strong>num_filters</strong> (<em>int</em>) &#8211; The number of filter. It is as same as the output
image channel.</li>
<li><strong>output_size</strong> (<em>int|tuple|None</em>) &#8211; The output image size. If output size is a
tuple, it must contain two integers, (image_H, image_W). This
parameter only works when filter_size is None.</li>
<li><strong>filter_size</strong> (<em>int|tuple|None</em>) &#8211; The filter size. If filter_size is a tuple,
it must contain two integers, (filter_size_H, filter_size_W).
Otherwise, the filter will be a square. None if use output size to
calculate filter_size</li>
<li><strong>padding</strong> (<em>int|tuple</em>) &#8211; The padding size. If padding is a tuple, it must
contain two integers, (padding_H, padding_W). Otherwise, the
padding_H = padding_W = padding.</li>
<li><strong>stride</strong> (<em>int|tuple</em>) &#8211; The stride size. If stride is a tuple, it must
contain two integers, (stride_H, stride_W). Otherwise, the
stride_H = stride_W = stride.</li>
<li><strong>param_attr</strong> &#8211; Parameter Attribute.</li>
<li><strong>main_program</strong> (<em>Program</em>) &#8211; the main program</li>
<li><strong>startup_program</strong> (<em>Program</em>) &#8211; the startup program</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">Output image.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">Variable</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
......
......@@ -208,12 +208,28 @@
<h1>Nets<a class="headerlink" href="#nets" title="永久链接至标题"></a></h1>
<div class="section" id="simple-img-conv-pool">
<h2>simple_img_conv_pool<a class="headerlink" href="#simple-img-conv-pool" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.nets.</code><code class="descname">simple_img_conv_pool</code><span class="sig-paren">(</span><em>input</em>, <em>num_filters</em>, <em>filter_size</em>, <em>pool_size</em>, <em>pool_stride</em>, <em>act</em>, <em>pool_type='max'</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
<div class="section" id="img-conv-group">
<h2>img_conv_group<a class="headerlink" href="#img-conv-group" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.nets.</code><code class="descname">img_conv_group</code><span class="sig-paren">(</span><em>input</em>, <em>conv_num_filter</em>, <em>pool_size</em>, <em>conv_padding=1</em>, <em>conv_filter_size=3</em>, <em>conv_act=None</em>, <em>conv_with_batchnorm=False</em>, <em>conv_batchnorm_drop_rate=None</em>, <em>pool_stride=1</em>, <em>pool_type=None</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>Image Convolution Group, Used for vgg net.</p>
</dd></dl>
</div>
<div class="section" id="sequence-conv-pool">
<h2>sequence_conv_pool<a class="headerlink" href="#sequence-conv-pool" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.nets.</code><code class="descname">sequence_conv_pool</code><span class="sig-paren">(</span><em>input</em>, <em>num_filters</em>, <em>filter_size</em>, <em>act='sigmoid'</em>, <em>pool_type='max'</em>, <em>main_program=None</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd></dd></dl>
</div>
</div>
......
......@@ -208,24 +208,105 @@
<h1>Optimizer<a class="headerlink" href="#optimizer" title="永久链接至标题"></a></h1>
<div class="section" id="id1">
<h2>Optimizer<a class="headerlink" href="#id1" title="永久链接至标题"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.optimizer.</code><code class="descname">Optimizer</code><span class="sig-paren">(</span><em>global_step=None</em><span class="sig-paren">)</span></dt>
<dd><p>Optimizer Base class.</p>
<p>Define the common interface of an optimizer.
User should not use this class directly,
but need to use one of it&#8217;s implementation.</p>
<dl class="method">
<dt>
<code class="descname">create_optimization_pass</code><span class="sig-paren">(</span><em>parameters_and_grads</em>, <em>loss</em>, <em>startup_program=None</em><span class="sig-paren">)</span></dt>
<dd><p>Add optimization operators to update gradients to variables.</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>loss</strong> &#8211; the target that this optimization is for.</li>
<li><strong>parameters_and_grads</strong> &#8211; a list of (variable, gradient) pair to update.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">a list of operators that will complete one step of
optimization. This will include parameter update ops, global step
update ops and any other custom ops required by subclasses to manage
their internal state.
:param startup_program:</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">return_op_list</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt>
<code class="descname">minimize</code><span class="sig-paren">(</span><em>loss</em>, <em>startup_program=None</em>, <em>parameter_list=None</em>, <em>no_grad_set=None</em><span class="sig-paren">)</span></dt>
<dd><p>Add operations to minimize <cite>loss</cite> by updating <cite>parameter_list</cite>.</p>
<p>This method combines interface <cite>append_backward_ops()</cite> and
<cite>create_optimization_pass()</cite> into one.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="sgdoptimizer">
<h2>SGDOptimizer<a class="headerlink" href="#sgdoptimizer" title="永久链接至标题"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.optimizer.</code><code class="descname">SGDOptimizer</code><span class="sig-paren">(</span><em>learning_rate</em>, <em>global_step=None</em><span class="sig-paren">)</span></dt>
<dd><p>Simple SGD optimizer without any state.</p>
</dd></dl>
</div>
<div class="section" id="momentumoptimizer">
<h2>MomentumOptimizer<a class="headerlink" href="#momentumoptimizer" title="永久链接至标题"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.optimizer.</code><code class="descname">MomentumOptimizer</code><span class="sig-paren">(</span><em>learning_rate</em>, <em>momentum</em>, <em>use_nesterov=False</em>, <em>global_step=None</em><span class="sig-paren">)</span></dt>
<dd><p>Simple Momentum optimizer with velocity state</p>
</dd></dl>
</div>
<div class="section" id="adagradoptimizer">
<h2>AdagradOptimizer<a class="headerlink" href="#adagradoptimizer" title="永久链接至标题"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.optimizer.</code><code class="descname">AdagradOptimizer</code><span class="sig-paren">(</span><em>learning_rate</em>, <em>epsilon=1e-06</em>, <em>global_step=None</em><span class="sig-paren">)</span></dt>
<dd><p>Simple Adagrad optimizer with moment state</p>
</dd></dl>
</div>
<div class="section" id="adamoptimizer">
<h2>AdamOptimizer<a class="headerlink" href="#adamoptimizer" title="永久链接至标题"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.optimizer.</code><code class="descname">AdamOptimizer</code><span class="sig-paren">(</span><em>learning_rate=0.001</em>, <em>beta1=0.9</em>, <em>beta2=0.999</em>, <em>epsilon=1e-08</em>, <em>global_step=None</em><span class="sig-paren">)</span></dt>
<dd><p>Implements the Adam Optimizer</p>
</dd></dl>
</div>
<div class="section" id="adamaxoptimizer">
<h2>AdamaxOptimizer<a class="headerlink" href="#adamaxoptimizer" title="永久链接至标题"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.optimizer.</code><code class="descname">AdamaxOptimizer</code><span class="sig-paren">(</span><em>learning_rate=0.001</em>, <em>beta1=0.9</em>, <em>beta2=0.999</em>, <em>epsilon=1e-08</em>, <em>global_step=None</em><span class="sig-paren">)</span></dt>
<dd><p>Implements the Adamax Optimizer</p>
</dd></dl>
</div>
<div class="section" id="decayedadagradoptimizer">
<h2>DecayedAdagradOptimizer<a class="headerlink" href="#decayedadagradoptimizer" title="永久链接至标题"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.optimizer.</code><code class="descname">DecayedAdagradOptimizer</code><span class="sig-paren">(</span><em>learning_rate</em>, <em>decay=0.95</em>, <em>epsilon=1e-06</em>, <em>global_step=None</em><span class="sig-paren">)</span></dt>
<dd><p>Simple Decayed Adagrad optimizer with moment state</p>
</dd></dl>
</div>
</div>
......
......@@ -208,6 +208,35 @@
<h1>Profiler<a class="headerlink" href="#profiler" title="永久链接至标题"></a></h1>
<div class="section" id="id1">
<h2>Profiler<a class="headerlink" href="#id1" title="永久链接至标题"></a></h2>
<dl class="function">
<dt>
<code class="descclassname">paddle.v2.fluid.profiler.</code><code class="descname">cuda_profiler</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwds</em><span class="sig-paren">)</span></dt>
<dd><p>The CUDA profiler.
This fuctions is used to profile CUDA program by CUDA runtime application
programming interface. The profiling result will be written into
<cite>output_file</cite> with Key-Value pair format or Comma separated values format.
The user can set the output mode by <cite>output_mode</cite> argument and set the
counters/options for profiling by <cite>config</cite> argument. The default config
is [&#8216;gpustarttimestamp&#8217;, &#8216;gpustarttimestamp&#8217;, &#8216;gridsize3d&#8217;,
&#8216;threadblocksize&#8217;, &#8216;streamid&#8217;, &#8216;enableonstart 0&#8217;, &#8216;conckerneltrace&#8217;].</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 last simple">
<li><strong>output_file</strong> (<em>string</em>) &#8211; The output file name, the result will be
written into this file.</li>
<li><strong>output_mode</strong> (<em>string</em>) &#8211; The output mode has Key-Value pair format and
Comma separated values format. It should be &#8216;kvp&#8217; or &#8216;csv&#8217;.</li>
<li><strong>config</strong> (<em>string</em>) &#8211; The profiler options and counters can refer to
&#8220;Compute Command Line Profiler User Guide&#8221;.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
......
......@@ -208,12 +208,36 @@
<h1>Regularizer<a class="headerlink" href="#regularizer" title="永久链接至标题"></a></h1>
<div class="section" id="weightdecayregularizer">
<h2>WeightDecayRegularizer<a class="headerlink" href="#weightdecayregularizer" title="永久链接至标题"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.regularizer.</code><code class="descname">WeightDecayRegularizer</code></dt>
<dd><p>Base class for weight decay regularizers</p>
<p>Defines the common interface of weight-decay regularizers.
Weight-decay regularizers are added only during the backward
pass for faster regularization. They add operations to the network
that correspond to gradient of the regularization function.
Users should not use this class directly, but need to use one
of its implementations</p>
</dd></dl>
</div>
<div class="section" id="l2decayregularizer">
<h2>L2DecayRegularizer<a class="headerlink" href="#l2decayregularizer" title="永久链接至标题"></a></h2>
<dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.regularizer.</code><code class="descname">L2DecayRegularizer</code><span class="sig-paren">(</span><em>regularization_coeff=0.0</em><span class="sig-paren">)</span></dt>
<dd><p>Implements the L2 Weight Decay Regularization</p>
</dd></dl>
</div>
<div class="section" id="l1decayregularizer">
<h2>L1DecayRegularizer<a class="headerlink" href="#l1decayregularizer" title="永久链接至标题"></a></h2>
<span class="target" id="module-paddle.v2.fluid.regularizer"></span><dl class="class">
<dt id="paddle.v2.fluid.regularizer.L1DecayRegularizer">
<em class="property">class </em><code class="descclassname">paddle.v2.fluid.regularizer.</code><code class="descname">L1DecayRegularizer</code><span class="sig-paren">(</span><em>regularization_coeff=0.0</em><span class="sig-paren">)</span><a class="headerlink" href="#paddle.v2.fluid.regularizer.L1DecayRegularizer" title="永久链接至目标"></a></dt>
<dd><p>Implements the L1 Weight Decay Regularization</p>
</dd></dl>
</div>
</div>
......
......@@ -212,6 +212,7 @@
<a href="#B"><strong>B</strong></a>
| <a href="#C"><strong>C</strong></a>
| <a href="#L"><strong>L</strong></a>
| <a href="#M"><strong>M</strong></a>
| <a href="#P"><strong>P</strong></a>
| <a href="#R"><strong>R</strong></a>
| <a href="#S"><strong>S</strong></a>
......@@ -237,12 +238,14 @@
<h2 id="L">L</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/v2/data/image.html#paddle.v2.image.left_right_flip">left_right_flip() (在 paddle.v2.image 模块中)</a>
<li><a href="api/v2/fluid/regularizer.html#paddle.v2.fluid.regularizer.L1DecayRegularizer">L1DecayRegularizer (paddle.v2.fluid.regularizer 中的类)</a>
</li>
<li><a href="api/v2/data/image.html#paddle.v2.image.load_and_transform">load_and_transform() (在 paddle.v2.image 模块中)</a>
<li><a href="api/v2/data/image.html#paddle.v2.image.left_right_flip">left_right_flip() (在 paddle.v2.image 模块中)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/v2/data/image.html#paddle.v2.image.load_and_transform">load_and_transform() (在 paddle.v2.image 模块中)</a>
</li>
<li><a href="api/v2/data/image.html#paddle.v2.image.load_image">load_image() (在 paddle.v2.image 模块中)</a>
</li>
<li><a href="api/v2/data/image.html#paddle.v2.image.load_image_bytes">load_image_bytes() (在 paddle.v2.image 模块中)</a>
......@@ -250,8 +253,20 @@
</ul></td>
</tr></table>
<h2 id="M">M</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/v2/fluid/evaluator.html#paddle.v2.fluid.evaluator.Evaluator.metrics">metrics (paddle.v2.fluid.evaluator.Evaluator 属性)</a>
</li>
</ul></td>
</tr></table>
<h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/v2/fluid/regularizer.html#module-paddle.v2.fluid.regularizer">paddle.v2.fluid.regularizer (模块)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/v2/data/image.html#module-paddle.v2.image">paddle.v2.image (模块)</a>
</li>
......@@ -274,6 +289,10 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/v2/data/image.html#paddle.v2.image.simple_transform">simple_transform() (在 paddle.v2.image 模块中)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/v2/fluid/evaluator.html#paddle.v2.fluid.evaluator.Evaluator.states">states (paddle.v2.fluid.evaluator.Evaluator 属性)</a>
</li>
</ul></td>
</tr></table>
......
......@@ -224,6 +224,11 @@
<td>
<code class="xref">paddle</code></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="api/v2/fluid/regularizer.html#module-paddle.v2.fluid.regularizer"><code class="xref">paddle.v2.fluid.regularizer</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册