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

Deploy to GitHub Pages: 298dc895

上级 03270b4c
......@@ -467,7 +467,7 @@ lambda_cost
:noindex:
square_error_cost
--------
-----------------
.. autoclass:: paddle.v2.layer.square_error_cost
:noindex:
......@@ -533,7 +533,7 @@ Miscs
=====
dropout
--------------
--------
.. autoclass:: paddle.v2.layer.dropout
:noindex:
......
......@@ -19,17 +19,17 @@ dynamic_lstm
:noindex:
data
---------
----
.. autofunction:: paddle.v2.fluid.layers.data
:noindex:
mean
---------
----
.. autofunction:: paddle.v2.fluid.layers.mean
:noindex:
mul
---------
---
.. autofunction:: paddle.v2.fluid.layers.mul
:noindex:
......@@ -45,13 +45,13 @@ elementwise_div
dropout
---------
-------
.. autofunction:: paddle.v2.fluid.layers.dropout
:noindex:
reshape
---------
--------
.. autofunction:: paddle.v2.fluid.layers.reshape
:noindex:
......@@ -81,67 +81,67 @@ transpose
sigmoid_cross_entropy_with_logits
---------
---------------------------------
.. autofunction:: paddle.v2.fluid.layers.esigmoid_cross_entropy_with_logits
:noindex:
cast
---------
----
.. autofunction:: paddle.v2.fluid.layers.cast
:noindex:
concat
---------
-------
.. autofunction:: paddle.v2.fluid.layers.concat
:noindex:
sums
---------
----
.. autofunction:: paddle.v2.fluid.layers.sums
:noindex:
linear_chain_crf
---------
----------------
.. autofunction:: paddle.v2.fluid.layers.linear_chain_crf
:noindex:
assign
---------
-------
.. autofunction:: paddle.v2.fluid.layers.embedding
:noindex:
split_lod_tensor
---------
----------------
.. autofunction:: paddle.v2.fluid.layers.split_lod_tensor
:noindex:
merge_lod_tensor
---------
----------------
.. autofunction:: paddle.v2.fluid.layers.merge_lod_tensor
:noindex:
cos_sim
---------
--------
.. autofunction:: paddle.v2.fluid.layers.cos_sim
:noindex:
cross_entropy
---------
-------------
.. autofunction:: paddle.v2.fluid.layers.cross_entropy
:noindex:
square_error_cost
---------
-----------------
.. autofunction:: paddle.v2.fluid.layers.square_error_cost
:noindex:
......@@ -153,68 +153,68 @@ accuracy
sequence_conv
---------
-------------
.. autofunction:: paddle.v2.fluid.layers.sequence_conv
:noindex:
conv2d
---------
------
.. autofunction:: paddle.v2.fluid.layers.conv2d
:noindex:
sequence_pool
---------
-------------
.. autofunction:: paddle.v2.fluid.layers.sequence_pool
:noindex:
pool2d
---------
------
.. autofunction:: paddle.v2.fluid.layers.pool2d
:noindex:
batch_norm
---------
----------
.. autofunction:: paddle.v2.fluid.layers.batch_norm
:noindex:
beam_search_decode
---------
------------------
.. autofunction:: paddle.v2.fluid.layers.beam_search_decode
:noindex:
lod_rank_table
---------
--------------
.. autofunction:: paddle.v2.fluid.layers.lod_rank_table
:noindex:
max_sequence_len
---------
----------------
.. autofunction:: paddle.v2.fluid.layers.max_sequence_len
:noindex:
topk
---------
-----
.. autofunction:: paddle.v2.fluid.layers.topk
:noindex:
lod_tensor_to_array
---------
-------------------
.. autofunction:: paddle.v2.fluid.layers.lod_tensor_to_array
:noindex:
array_to_lod_tensor
---------
-------------------
.. autofunction:: paddle.v2.fluid.layers.array_to_lod_tensor
:noindex:
......@@ -222,26 +222,26 @@ array_to_lod_tensor
fill_constant
---------
-------------
.. autofunction:: paddle.v2.fluid.layers.fill_constant
:noindex:
fill_constant_batch_size_like
---------
-----------------------------
.. autofunction:: paddle.v2.fluid.layers.fill_constant_batch_size_like
:noindex:
ones
---------
----
.. autofunction:: paddle.v2.fluid.layers.ones
:noindex:
zeros
---------
-----
.. autofunction:: paddle.v2.fluid.layers.zeros
:noindex:
......@@ -253,14 +253,14 @@ increment
array_write
---------
-----------
.. autofunction:: paddle.v2.fluid.layers.array_write
:noindex:
create_array
---------
------------
.. autofunction:: paddle.v2.fluid.layers.create_array
:noindex:
......@@ -272,31 +272,31 @@ less_than
array_read
---------
----------
.. autofunction:: paddle.v2.fluid.layers.array_read
:noindex:
shrink_memory
---------
--------------
.. autofunction:: paddle.v2.fluid.layers.shrink_memory
:noindex:
array_length
---------
-------------
.. autofunction:: paddle.v2.fluid.layers.array_length
:noindex:
conv2d_transpose
---------
----------------
.. autofunction:: paddle.v2.fluid.layers.conv2d_transpose
:noindex:
sequence_expand
---------
---------------
.. autofunction:: paddle.v2.fluid.layers.sequence_expand
:noindex:
......@@ -308,13 +308,13 @@ lstm_unit
sequence_softmax
---------
----------------
.. autofunction:: paddle.v2.fluid.layers.sequence_softmax
:noindex:
reduce_sum
---------
----------
.. autofunction:: paddle.v2.fluid.layers.reduce_sum
:noindex:
......@@ -3,19 +3,19 @@ Nets
===========
simple_img_conv_pool
-----------
--------------------
.. autofunction:: paddle.v2.fluid.nets.simple_img_conv_pool
:noindex:
img_conv_group
-----------
---------------
.. autofunction:: paddle.v2.fluid.nets.img_conv_group
:noindex:
sequence_conv_pool
-----------
------------------
.. autofunction:: paddle.v2.fluid.nets.sequence_conv_pool
:noindex:
......
......@@ -18,7 +18,7 @@ SGDOptimizer
MomentumOptimizer
-----------
-----------------
.. automodule:: paddle.v2.fluid.optimizer
:members: MomentumOptimizer
:noindex:
......@@ -26,14 +26,14 @@ MomentumOptimizer
AdagradOptimizer
-----------
----------------
.. automodule:: paddle.v2.fluid.optimizer
:members: AdagradOptimizer
:noindex:
AdamOptimizer
-----------
-------------
.. automodule:: paddle.v2.fluid.optimizer
:members: AdamOptimizer
:noindex:
......@@ -47,7 +47,7 @@ AdamaxOptimizer
DecayedAdagradOptimizer
-----------
-----------------------
.. automodule:: paddle.v2.fluid.optimizer
:members: DecayedAdagradOptimizer
:noindex:
......
......@@ -3,14 +3,14 @@ Regularizer
===========
WeightDecayRegularizer
-----------
----------------------
.. automodule:: paddle.v2.fluid.regularizer
:members: WeightDecayRegularizer
:noindex:
L2DecayRegularizer
-----------
------------------
.. automodule:: paddle.v2.fluid.regularizer
:members: L2DecayRegularizer
:noindex:
......@@ -18,7 +18,7 @@ L2DecayRegularizer
L1DecayRegularizer
-----------
-------------------
.. automodule:: paddle.v2.fluid.regularizer
:members: L1DecayRegularizer
......
......@@ -222,55 +222,83 @@
<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><span class="sig-paren">)</span></dt>
<dd><p><strong>Fully Connected Layer</strong></p>
<p>This layer accepts multiple inputs and applies a linear transformation to each input.
If activation type is provided, the corresponding activation function is applied to the
output of the linear transformation. For each input <span class="math">\(X\)</span>, the equation is:</p>
<dd><blockquote>
<div><p><strong>Fully Connected Layer</strong></p>
<p>The fully connected layer can take multiple tensors as its inputs. It
creates a variable (one for each input tensor) called weights for each input
tensor, which represents a fully connected weight matrix from each input
unit to each output unit. The fully connected layer multiplies each input
tensor with its coresponding weight to produce an output Tensor. If
multiple input tensors are given, the results of multiple multiplications
will be sumed up. If bias_attr is not None, a biases variable will be
created and added to the output. Finally, if activation is not None,
it will be applied to the output as well.</p>
<p>This process can be formulated as follows:</p>
<div class="math">
\[Out = Act(WX + b)\]</div>
<p>In the above equation:</p>
<blockquote>
<div><ul class="simple">
<li><span class="math">\(X\)</span>: Input value, a tensor with rank at least 2.</li>
<li><span class="math">\(W\)</span>: Weight, a 2-D tensor with shape [M, N].</li>
<li><span class="math">\(b\)</span>: Bias, a 2-D tensor with shape [M, 1].</li>
<li><span class="math">\(Act\)</span>: Activation function.</li>
<li><span class="math">\(Out\)</span>: Output value, same shape with <span class="math">\(X\)</span>.</li>
</ul>
\[Out = Act\left({\sum_{i=0}^{N-1}W_iX_i + b}\]</div>
</div></blockquote>
<p>All the input variables are passed in as local variables to the LayerHelper
constructor.</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|list</em>) &#8211; Input tensors. Each tensor has a rank of atleast 2</li>
<li><strong>size</strong> (<em>int</em>) &#8211; Output size</li>
<li><strong>num_flatten_dims</strong> (<em>int</em>) &#8211; Number of columns in input</li>
<li><strong>param_attr</strong> (<em>ParamAttr|list</em>) &#8211; The parameters/weights to the FC Layer</li>
<li><strong>bias_attr</strong> (<em>ParamAttr|list</em>) &#8211; Bias parameter for the FC layer</li>
<li><strong>act</strong> (<em>str</em>) &#8211; Activation type</li>
<li><strong>name</strong> (<em>str</em>) &#8211; Name/alias of the function</li>
<p>ight)</p>
<blockquote>
<div><p>In the above equation:</p>
<ul class="simple">
<li><span class="math">\(N\)</span>: Number of the input.</li>
<li><span class="math">\(X_i\)</span>: The input tensor.</li>
<li><span class="math">\(W\)</span>: The weights created by this layer.</li>
<li><span class="math">\(b\)</span>: The bias parameter created by this layer (if needed).</li>
<li><span class="math">\(Act\)</span>: The activation funtion.</li>
<li><span class="math">\(Out\)</span>: The output tensor.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The tensor variable storing the transformation and non-linearity activation result.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">Variable</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code> &#8211; If rank of input tensor is less than 2.</p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">data</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;data&#39;</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">[</span><span class="mi">32</span><span class="p">,</span> <span class="mi">32</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="s1">&#39;float32&#39;</span><span class="p">)</span>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">input(Variable|list): The input tensor(s) to the fully connected layer.
size(int): The number of output units in the fully connected layer.
num_flatten_dims(int): The fc layer can accept an input tensor with more</p>
<blockquote>
<div>than two dimensions. If this happens, the
multidimensional tensor will first be flattened
into a 2-dimensional matrix. The parameter
<cite>num_flatten_dims</cite> determines how the input tensor
is flattened: the first <cite>num_flatten_dims</cite>
dimensions will be flatten to form the first
dimension of the final matrix (height of the
matrix), and the rest <cite>rank(X) - num_col_dims</cite>
dimensions are flattened to form the second
dimension of the final matrix (width of the matrix).
For example, suppose <cite>X</cite> is a 6-dimensional tensor
with a shape [2, 3, 4, 5, 6], and
<cite>x_num_col_dims</cite> = 3. Then, the flattened matrix
will have a shape [2 x 3 x 4, 5 x 6] = [24, 30].
By default, <cite>x_num_col_dims</cite> is set to 1.</div></blockquote>
<dl class="docutils">
<dt>param_attr(ParamAttr|list): The parameter attribute for learnable</dt>
<dd>parameters/weights of the fully connected
layer.</dd>
<dt>param_initializer(ParamAttr|list): The initializer used for the</dt>
<dd>weight/parameter. If set None,
XavierInitializer() will be used.</dd>
<dt>bias_attr(ParamAttr|list): The parameter attribute for the bias parameter</dt>
<dd>for this layer. If set None, no bias will be
added to the output units.</dd>
<dt>bias_initializer(ParamAttr|list): The initializer used for the bias.</dt>
<dd>If set None, then ConstantInitializer()
will be used.</dd>
<dt>act(str): Activation to be applied to the output of the fully connected</dt>
<dd>layer.</dd>
</dl>
<p class="last">name(str): Name/alias of the fully connected layer.</p>
</dd>
<dt>Returns:</dt>
<dd>Variable: The output tensor variable.</dd>
<dt>Raises:</dt>
<dd>ValueError: If rank of the input tensor is less than 2.</dd>
<dt>Examples:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span></span><span class="n">data</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;data&quot;</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">[</span><span class="mi">32</span><span class="p">,</span> <span class="mi">32</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="s2">&quot;float32&quot;</span><span class="p">)</span>
<span class="n">fc</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">fc</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="n">data</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">1000</span><span class="p">,</span> <span class="n">act</span><span class="o">=</span><span class="s2">&quot;tanh&quot;</span><span class="p">)</span>
</pre></div>
</div>
</dd>
</dl>
</div></blockquote>
</dd></dl>
</div>
......@@ -392,32 +420,45 @@ Duplicable: False Optional: False</td>
<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>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>
<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; The first input of mul op
<li><strong>x</strong> &#8211; (Tensor), The first input tensor of mul op.
Duplicable: False Optional: False</li>
<li><strong>y</strong> &#8211; The second input of mul op
<li><strong>y</strong> &#8211; (Tensor), The second input tensor 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>
<li><strong>x_num_col_dims</strong> (<em>INT</em>) &#8211; (int, default 1), The mul_op can take tensors with more than two
dimensions as its inputs. If the input $X$ is a tensor with more
than two dimensions, $X$ will be flattened into a two-dimensional
matrix first. The flattening rule is: the first <cite>num_col_dims</cite>
will be flattened to form the first dimension of the final matrix
(the height of the matrix), and the rest <cite>rank(X) - num_col_dims</cite>
dimensions are flattened to form the second dimension of the final
matrix (the width of the matrix). As a result, height of the
flattened matrix is equal to the product of $X$&#8217;s first
<cite>x_num_col_dims</cite> dimensions&#8217; sizes, and width of the flattened
matrix is equal to the product of $X$&#8217;s last <cite>rank(x) - num_col_dims</cite>
dimensions&#8217; size. For example, suppose $X$ is a 6-dimensional
tensor with the shape [2, 3, 4, 5, 6], and <cite>x_num_col_dims</cite> = 3.
Thus, the flattened matrix will have a shape [2 x 3 x 4, 5 x 6] =
[24, 30].</li>
<li><strong>y_num_col_dims</strong> (<em>INT</em>) &#8211; (int, default 1), The mul_op can take tensors with more than two,
dimensions as its inputs. If the input $Y$ is a tensor with more
than two dimensions, $Y$ will be flattened into a two-dimensional
matrix first. The attribute <cite>y_num_col_dims</cite> determines how $Y$ is
flattened. See comments of <cite>x_num_col_dims</cite> for more details.</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>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">(Tensor), The output tensor of mul op.</p>
</td>
</tr>
</tbody>
......
......@@ -241,9 +241,9 @@ of its implementations</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">
<div class="section" id="module-paddle.v2.fluid.regularizer">
<span id="l1decayregularizer"></span><h2>L1DecayRegularizer<a class="headerlink" href="#module-paddle.v2.fluid.regularizer" title="Permalink to this headline"></a></h2>
<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>
......
......@@ -1212,23 +1212,23 @@
} ]
},{
"type" : "mul",
"comment" : "\nMul Operator. \n\nThis operator is used to perform matrix multiplication for input X and Y.\n\nThe equation is:\n\n $$Out = X * Y$$\n\nBoth the input `X` and `Y` can carry the LoD (Level of Details) information,\nor not. But the output only shares the LoD information with input `X`.\n\n",
"comment" : "\nMul Operator.\n\nThis operator is used to perform matrix multiplication for input $X$ and $Y$.\n\nThe equation is:\n\n $$Out = X * Y$$\n\nBoth the input $X$ and $Y$ can carry the LoD (Level of Details) information,\nor not. But the output only shares the LoD information with input $X$.\n\n",
"inputs" : [
{
"name" : "X",
"comment" : "The first input of mul op",
"comment" : "(Tensor), The first input tensor of mul op.",
"duplicable" : 0,
"intermediate" : 0
}, {
"name" : "Y",
"comment" : "The second input of mul op",
"comment" : "(Tensor), The second input tensor of mul op.",
"duplicable" : 0,
"intermediate" : 0
} ],
"outputs" : [
{
"name" : "Out",
"comment" : "The output of mul op",
"comment" : "(Tensor), The output tensor of mul op.",
"duplicable" : 0,
"intermediate" : 0
} ],
......@@ -1236,12 +1236,12 @@
{
"name" : "x_num_col_dims",
"type" : "int",
"comment" : "(int, default 1) mul_op can take tensors with more than two dimensions as input `X`,\n in that case, tensors will be reshaped to a matrix. The matrix's first\n dimension(column length) will be the product of tensor's last\n `num_col_dims` dimensions, and the matrix's second dimension(row length)\n will be the product of tensor's first `rank - num_col_dims` dimensions.\n ",
"comment" : "(int, default 1), The mul_op can take tensors with more than two\n dimensions as its inputs. If the input $X$ is a tensor with more\n than two dimensions, $X$ will be flattened into a two-dimensional\n matrix first. The flattening rule is: the first `num_col_dims`\n will be flattened to form the first dimension of the final matrix\n (the height of the matrix), and the rest `rank(X) - num_col_dims`\n dimensions are flattened to form the second dimension of the final\n matrix (the width of the matrix). As a result, height of the\n flattened matrix is equal to the product of $X$'s first\n `x_num_col_dims` dimensions' sizes, and width of the flattened\n matrix is equal to the product of $X$'s last `rank(x) - num_col_dims`\n dimensions' size. For example, suppose $X$ is a 6-dimensional\n tensor with the shape [2, 3, 4, 5, 6], and `x_num_col_dims` = 3.\n Thus, the flattened matrix will have a shape [2 x 3 x 4, 5 x 6] =\n [24, 30].\n ",
"generated" : 0
}, {
"name" : "y_num_col_dims",
"type" : "int",
"comment" : "(int, default 1) mul_op can take tensors with more than two dimensions as input `Y`,\n in that case, tensors will be reshaped to a matrix. Just like input `X`.\n ",
"comment" : "(int, default 1), The mul_op can take tensors with more than two,\n dimensions as its inputs. If the input $Y$ is a tensor with more\n than two dimensions, $Y$ will be flattened into a two-dimensional\n matrix first. The attribute `y_num_col_dims` determines how $Y$ is\n flattened. See comments of `x_num_col_dims` for more details.\n ",
"generated" : 0
} ]
},{
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -467,7 +467,7 @@ lambda_cost
:noindex:
square_error_cost
--------
-----------------
.. autoclass:: paddle.v2.layer.square_error_cost
:noindex:
......@@ -533,7 +533,7 @@ Miscs
=====
dropout
--------------
--------
.. autoclass:: paddle.v2.layer.dropout
:noindex:
......
......@@ -19,17 +19,17 @@ dynamic_lstm
:noindex:
data
---------
----
.. autofunction:: paddle.v2.fluid.layers.data
:noindex:
mean
---------
----
.. autofunction:: paddle.v2.fluid.layers.mean
:noindex:
mul
---------
---
.. autofunction:: paddle.v2.fluid.layers.mul
:noindex:
......@@ -45,13 +45,13 @@ elementwise_div
dropout
---------
-------
.. autofunction:: paddle.v2.fluid.layers.dropout
:noindex:
reshape
---------
--------
.. autofunction:: paddle.v2.fluid.layers.reshape
:noindex:
......@@ -81,67 +81,67 @@ transpose
sigmoid_cross_entropy_with_logits
---------
---------------------------------
.. autofunction:: paddle.v2.fluid.layers.esigmoid_cross_entropy_with_logits
:noindex:
cast
---------
----
.. autofunction:: paddle.v2.fluid.layers.cast
:noindex:
concat
---------
-------
.. autofunction:: paddle.v2.fluid.layers.concat
:noindex:
sums
---------
----
.. autofunction:: paddle.v2.fluid.layers.sums
:noindex:
linear_chain_crf
---------
----------------
.. autofunction:: paddle.v2.fluid.layers.linear_chain_crf
:noindex:
assign
---------
-------
.. autofunction:: paddle.v2.fluid.layers.embedding
:noindex:
split_lod_tensor
---------
----------------
.. autofunction:: paddle.v2.fluid.layers.split_lod_tensor
:noindex:
merge_lod_tensor
---------
----------------
.. autofunction:: paddle.v2.fluid.layers.merge_lod_tensor
:noindex:
cos_sim
---------
--------
.. autofunction:: paddle.v2.fluid.layers.cos_sim
:noindex:
cross_entropy
---------
-------------
.. autofunction:: paddle.v2.fluid.layers.cross_entropy
:noindex:
square_error_cost
---------
-----------------
.. autofunction:: paddle.v2.fluid.layers.square_error_cost
:noindex:
......@@ -153,68 +153,68 @@ accuracy
sequence_conv
---------
-------------
.. autofunction:: paddle.v2.fluid.layers.sequence_conv
:noindex:
conv2d
---------
------
.. autofunction:: paddle.v2.fluid.layers.conv2d
:noindex:
sequence_pool
---------
-------------
.. autofunction:: paddle.v2.fluid.layers.sequence_pool
:noindex:
pool2d
---------
------
.. autofunction:: paddle.v2.fluid.layers.pool2d
:noindex:
batch_norm
---------
----------
.. autofunction:: paddle.v2.fluid.layers.batch_norm
:noindex:
beam_search_decode
---------
------------------
.. autofunction:: paddle.v2.fluid.layers.beam_search_decode
:noindex:
lod_rank_table
---------
--------------
.. autofunction:: paddle.v2.fluid.layers.lod_rank_table
:noindex:
max_sequence_len
---------
----------------
.. autofunction:: paddle.v2.fluid.layers.max_sequence_len
:noindex:
topk
---------
-----
.. autofunction:: paddle.v2.fluid.layers.topk
:noindex:
lod_tensor_to_array
---------
-------------------
.. autofunction:: paddle.v2.fluid.layers.lod_tensor_to_array
:noindex:
array_to_lod_tensor
---------
-------------------
.. autofunction:: paddle.v2.fluid.layers.array_to_lod_tensor
:noindex:
......@@ -222,26 +222,26 @@ array_to_lod_tensor
fill_constant
---------
-------------
.. autofunction:: paddle.v2.fluid.layers.fill_constant
:noindex:
fill_constant_batch_size_like
---------
-----------------------------
.. autofunction:: paddle.v2.fluid.layers.fill_constant_batch_size_like
:noindex:
ones
---------
----
.. autofunction:: paddle.v2.fluid.layers.ones
:noindex:
zeros
---------
-----
.. autofunction:: paddle.v2.fluid.layers.zeros
:noindex:
......@@ -253,14 +253,14 @@ increment
array_write
---------
-----------
.. autofunction:: paddle.v2.fluid.layers.array_write
:noindex:
create_array
---------
------------
.. autofunction:: paddle.v2.fluid.layers.create_array
:noindex:
......@@ -272,31 +272,31 @@ less_than
array_read
---------
----------
.. autofunction:: paddle.v2.fluid.layers.array_read
:noindex:
shrink_memory
---------
--------------
.. autofunction:: paddle.v2.fluid.layers.shrink_memory
:noindex:
array_length
---------
-------------
.. autofunction:: paddle.v2.fluid.layers.array_length
:noindex:
conv2d_transpose
---------
----------------
.. autofunction:: paddle.v2.fluid.layers.conv2d_transpose
:noindex:
sequence_expand
---------
---------------
.. autofunction:: paddle.v2.fluid.layers.sequence_expand
:noindex:
......@@ -308,13 +308,13 @@ lstm_unit
sequence_softmax
---------
----------------
.. autofunction:: paddle.v2.fluid.layers.sequence_softmax
:noindex:
reduce_sum
---------
----------
.. autofunction:: paddle.v2.fluid.layers.reduce_sum
:noindex:
......@@ -3,19 +3,19 @@ Nets
===========
simple_img_conv_pool
-----------
--------------------
.. autofunction:: paddle.v2.fluid.nets.simple_img_conv_pool
:noindex:
img_conv_group
-----------
---------------
.. autofunction:: paddle.v2.fluid.nets.img_conv_group
:noindex:
sequence_conv_pool
-----------
------------------
.. autofunction:: paddle.v2.fluid.nets.sequence_conv_pool
:noindex:
......
......@@ -18,7 +18,7 @@ SGDOptimizer
MomentumOptimizer
-----------
-----------------
.. automodule:: paddle.v2.fluid.optimizer
:members: MomentumOptimizer
:noindex:
......@@ -26,14 +26,14 @@ MomentumOptimizer
AdagradOptimizer
-----------
----------------
.. automodule:: paddle.v2.fluid.optimizer
:members: AdagradOptimizer
:noindex:
AdamOptimizer
-----------
-------------
.. automodule:: paddle.v2.fluid.optimizer
:members: AdamOptimizer
:noindex:
......@@ -47,7 +47,7 @@ AdamaxOptimizer
DecayedAdagradOptimizer
-----------
-----------------------
.. automodule:: paddle.v2.fluid.optimizer
:members: DecayedAdagradOptimizer
:noindex:
......
......@@ -3,14 +3,14 @@ Regularizer
===========
WeightDecayRegularizer
-----------
----------------------
.. automodule:: paddle.v2.fluid.regularizer
:members: WeightDecayRegularizer
:noindex:
L2DecayRegularizer
-----------
------------------
.. automodule:: paddle.v2.fluid.regularizer
:members: L2DecayRegularizer
:noindex:
......@@ -18,7 +18,7 @@ L2DecayRegularizer
L1DecayRegularizer
-----------
-------------------
.. automodule:: paddle.v2.fluid.regularizer
:members: L1DecayRegularizer
......
......@@ -235,55 +235,83 @@
<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><span class="sig-paren">)</span></dt>
<dd><p><strong>Fully Connected Layer</strong></p>
<p>This layer accepts multiple inputs and applies a linear transformation to each input.
If activation type is provided, the corresponding activation function is applied to the
output of the linear transformation. For each input <span class="math">\(X\)</span>, the equation is:</p>
<dd><blockquote>
<div><p><strong>Fully Connected Layer</strong></p>
<p>The fully connected layer can take multiple tensors as its inputs. It
creates a variable (one for each input tensor) called weights for each input
tensor, which represents a fully connected weight matrix from each input
unit to each output unit. The fully connected layer multiplies each input
tensor with its coresponding weight to produce an output Tensor. If
multiple input tensors are given, the results of multiple multiplications
will be sumed up. If bias_attr is not None, a biases variable will be
created and added to the output. Finally, if activation is not None,
it will be applied to the output as well.</p>
<p>This process can be formulated as follows:</p>
<div class="math">
\[Out = Act(WX + b)\]</div>
<p>In the above equation:</p>
<blockquote>
<div><ul class="simple">
<li><span class="math">\(X\)</span>: Input value, a tensor with rank at least 2.</li>
<li><span class="math">\(W\)</span>: Weight, a 2-D tensor with shape [M, N].</li>
<li><span class="math">\(b\)</span>: Bias, a 2-D tensor with shape [M, 1].</li>
<li><span class="math">\(Act\)</span>: Activation function.</li>
<li><span class="math">\(Out\)</span>: Output value, same shape with <span class="math">\(X\)</span>.</li>
</ul>
\[Out = Act\left({\sum_{i=0}^{N-1}W_iX_i + b}\]</div>
</div></blockquote>
<p>All the input variables are passed in as local variables to the LayerHelper
constructor.</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|list</em>) &#8211; Input tensors. Each tensor has a rank of atleast 2</li>
<li><strong>size</strong> (<em>int</em>) &#8211; Output size</li>
<li><strong>num_flatten_dims</strong> (<em>int</em>) &#8211; Number of columns in input</li>
<li><strong>param_attr</strong> (<em>ParamAttr|list</em>) &#8211; The parameters/weights to the FC Layer</li>
<li><strong>bias_attr</strong> (<em>ParamAttr|list</em>) &#8211; Bias parameter for the FC layer</li>
<li><strong>act</strong> (<em>str</em>) &#8211; Activation type</li>
<li><strong>name</strong> (<em>str</em>) &#8211; Name/alias of the function</li>
<p>ight)</p>
<blockquote>
<div><p>In the above equation:</p>
<ul class="simple">
<li><span class="math">\(N\)</span>: Number of the input.</li>
<li><span class="math">\(X_i\)</span>: The input tensor.</li>
<li><span class="math">\(W\)</span>: The weights created by this layer.</li>
<li><span class="math">\(b\)</span>: The bias parameter created by this layer (if needed).</li>
<li><span class="math">\(Act\)</span>: The activation funtion.</li>
<li><span class="math">\(Out\)</span>: The output tensor.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">The tensor variable storing the transformation and non-linearity activation result.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first">Variable</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code> &#8211; If rank of input tensor is less than 2.</p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">data</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;data&#39;</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">[</span><span class="mi">32</span><span class="p">,</span> <span class="mi">32</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="s1">&#39;float32&#39;</span><span class="p">)</span>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">input(Variable|list): The input tensor(s) to the fully connected layer.
size(int): The number of output units in the fully connected layer.
num_flatten_dims(int): The fc layer can accept an input tensor with more</p>
<blockquote>
<div>than two dimensions. If this happens, the
multidimensional tensor will first be flattened
into a 2-dimensional matrix. The parameter
<cite>num_flatten_dims</cite> determines how the input tensor
is flattened: the first <cite>num_flatten_dims</cite>
dimensions will be flatten to form the first
dimension of the final matrix (height of the
matrix), and the rest <cite>rank(X) - num_col_dims</cite>
dimensions are flattened to form the second
dimension of the final matrix (width of the matrix).
For example, suppose <cite>X</cite> is a 6-dimensional tensor
with a shape [2, 3, 4, 5, 6], and
<cite>x_num_col_dims</cite> = 3. Then, the flattened matrix
will have a shape [2 x 3 x 4, 5 x 6] = [24, 30].
By default, <cite>x_num_col_dims</cite> is set to 1.</div></blockquote>
<dl class="docutils">
<dt>param_attr(ParamAttr|list): The parameter attribute for learnable</dt>
<dd>parameters/weights of the fully connected
layer.</dd>
<dt>param_initializer(ParamAttr|list): The initializer used for the</dt>
<dd>weight/parameter. If set None,
XavierInitializer() will be used.</dd>
<dt>bias_attr(ParamAttr|list): The parameter attribute for the bias parameter</dt>
<dd>for this layer. If set None, no bias will be
added to the output units.</dd>
<dt>bias_initializer(ParamAttr|list): The initializer used for the bias.</dt>
<dd>If set None, then ConstantInitializer()
will be used.</dd>
<dt>act(str): Activation to be applied to the output of the fully connected</dt>
<dd>layer.</dd>
</dl>
<p class="last">name(str): Name/alias of the fully connected layer.</p>
</dd>
<dt>Returns:</dt>
<dd>Variable: The output tensor variable.</dd>
<dt>Raises:</dt>
<dd>ValueError: If rank of the input tensor is less than 2.</dd>
<dt>Examples:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span></span><span class="n">data</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">data</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;data&quot;</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">[</span><span class="mi">32</span><span class="p">,</span> <span class="mi">32</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="s2">&quot;float32&quot;</span><span class="p">)</span>
<span class="n">fc</span> <span class="o">=</span> <span class="n">fluid</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">fc</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="n">data</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">1000</span><span class="p">,</span> <span class="n">act</span><span class="o">=</span><span class="s2">&quot;tanh&quot;</span><span class="p">)</span>
</pre></div>
</div>
</dd>
</dl>
</div></blockquote>
</dd></dl>
</div>
......@@ -405,32 +433,45 @@ Duplicable: False Optional: False</td>
<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>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>
<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; The first input of mul op
<li><strong>x</strong> &#8211; (Tensor), The first input tensor of mul op.
Duplicable: False Optional: False</li>
<li><strong>y</strong> &#8211; The second input of mul op
<li><strong>y</strong> &#8211; (Tensor), The second input tensor 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>
<li><strong>x_num_col_dims</strong> (<em>INT</em>) &#8211; (int, default 1), The mul_op can take tensors with more than two
dimensions as its inputs. If the input $X$ is a tensor with more
than two dimensions, $X$ will be flattened into a two-dimensional
matrix first. The flattening rule is: the first <cite>num_col_dims</cite>
will be flattened to form the first dimension of the final matrix
(the height of the matrix), and the rest <cite>rank(X) - num_col_dims</cite>
dimensions are flattened to form the second dimension of the final
matrix (the width of the matrix). As a result, height of the
flattened matrix is equal to the product of $X$&#8217;s first
<cite>x_num_col_dims</cite> dimensions&#8217; sizes, and width of the flattened
matrix is equal to the product of $X$&#8217;s last <cite>rank(x) - num_col_dims</cite>
dimensions&#8217; size. For example, suppose $X$ is a 6-dimensional
tensor with the shape [2, 3, 4, 5, 6], and <cite>x_num_col_dims</cite> = 3.
Thus, the flattened matrix will have a shape [2 x 3 x 4, 5 x 6] =
[24, 30].</li>
<li><strong>y_num_col_dims</strong> (<em>INT</em>) &#8211; (int, default 1), The mul_op can take tensors with more than two,
dimensions as its inputs. If the input $Y$ is a tensor with more
than two dimensions, $Y$ will be flattened into a two-dimensional
matrix first. The attribute <cite>y_num_col_dims</cite> determines how $Y$ is
flattened. See comments of <cite>x_num_col_dims</cite> for more details.</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>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first last">(Tensor), The output tensor of mul op.</p>
</td>
</tr>
</tbody>
......
......@@ -254,9 +254,9 @@ of its implementations</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">
<div class="section" id="module-paddle.v2.fluid.regularizer">
<span id="l1decayregularizer"></span><h2>L1DecayRegularizer<a class="headerlink" href="#module-paddle.v2.fluid.regularizer" title="永久链接至标题"></a></h2>
<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>
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册