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

Deploy to GitHub Pages: 298dc895

上级 03270b4c
...@@ -467,7 +467,7 @@ lambda_cost ...@@ -467,7 +467,7 @@ lambda_cost
:noindex: :noindex:
square_error_cost square_error_cost
-------- -----------------
.. autoclass:: paddle.v2.layer.square_error_cost .. autoclass:: paddle.v2.layer.square_error_cost
:noindex: :noindex:
...@@ -533,7 +533,7 @@ Miscs ...@@ -533,7 +533,7 @@ Miscs
===== =====
dropout dropout
-------------- --------
.. autoclass:: paddle.v2.layer.dropout .. autoclass:: paddle.v2.layer.dropout
:noindex: :noindex:
......
...@@ -19,17 +19,17 @@ dynamic_lstm ...@@ -19,17 +19,17 @@ dynamic_lstm
:noindex: :noindex:
data data
--------- ----
.. autofunction:: paddle.v2.fluid.layers.data .. autofunction:: paddle.v2.fluid.layers.data
:noindex: :noindex:
mean mean
--------- ----
.. autofunction:: paddle.v2.fluid.layers.mean .. autofunction:: paddle.v2.fluid.layers.mean
:noindex: :noindex:
mul mul
--------- ---
.. autofunction:: paddle.v2.fluid.layers.mul .. autofunction:: paddle.v2.fluid.layers.mul
:noindex: :noindex:
...@@ -45,13 +45,13 @@ elementwise_div ...@@ -45,13 +45,13 @@ elementwise_div
dropout dropout
--------- -------
.. autofunction:: paddle.v2.fluid.layers.dropout .. autofunction:: paddle.v2.fluid.layers.dropout
:noindex: :noindex:
reshape reshape
--------- --------
.. autofunction:: paddle.v2.fluid.layers.reshape .. autofunction:: paddle.v2.fluid.layers.reshape
:noindex: :noindex:
...@@ -81,67 +81,67 @@ transpose ...@@ -81,67 +81,67 @@ transpose
sigmoid_cross_entropy_with_logits sigmoid_cross_entropy_with_logits
--------- ---------------------------------
.. autofunction:: paddle.v2.fluid.layers.esigmoid_cross_entropy_with_logits .. autofunction:: paddle.v2.fluid.layers.esigmoid_cross_entropy_with_logits
:noindex: :noindex:
cast cast
--------- ----
.. autofunction:: paddle.v2.fluid.layers.cast .. autofunction:: paddle.v2.fluid.layers.cast
:noindex: :noindex:
concat concat
--------- -------
.. autofunction:: paddle.v2.fluid.layers.concat .. autofunction:: paddle.v2.fluid.layers.concat
:noindex: :noindex:
sums sums
--------- ----
.. autofunction:: paddle.v2.fluid.layers.sums .. autofunction:: paddle.v2.fluid.layers.sums
:noindex: :noindex:
linear_chain_crf linear_chain_crf
--------- ----------------
.. autofunction:: paddle.v2.fluid.layers.linear_chain_crf .. autofunction:: paddle.v2.fluid.layers.linear_chain_crf
:noindex: :noindex:
assign assign
--------- -------
.. autofunction:: paddle.v2.fluid.layers.embedding .. autofunction:: paddle.v2.fluid.layers.embedding
:noindex: :noindex:
split_lod_tensor split_lod_tensor
--------- ----------------
.. autofunction:: paddle.v2.fluid.layers.split_lod_tensor .. autofunction:: paddle.v2.fluid.layers.split_lod_tensor
:noindex: :noindex:
merge_lod_tensor merge_lod_tensor
--------- ----------------
.. autofunction:: paddle.v2.fluid.layers.merge_lod_tensor .. autofunction:: paddle.v2.fluid.layers.merge_lod_tensor
:noindex: :noindex:
cos_sim cos_sim
--------- --------
.. autofunction:: paddle.v2.fluid.layers.cos_sim .. autofunction:: paddle.v2.fluid.layers.cos_sim
:noindex: :noindex:
cross_entropy cross_entropy
--------- -------------
.. autofunction:: paddle.v2.fluid.layers.cross_entropy .. autofunction:: paddle.v2.fluid.layers.cross_entropy
:noindex: :noindex:
square_error_cost square_error_cost
--------- -----------------
.. autofunction:: paddle.v2.fluid.layers.square_error_cost .. autofunction:: paddle.v2.fluid.layers.square_error_cost
:noindex: :noindex:
...@@ -153,68 +153,68 @@ accuracy ...@@ -153,68 +153,68 @@ accuracy
sequence_conv sequence_conv
--------- -------------
.. autofunction:: paddle.v2.fluid.layers.sequence_conv .. autofunction:: paddle.v2.fluid.layers.sequence_conv
:noindex: :noindex:
conv2d conv2d
--------- ------
.. autofunction:: paddle.v2.fluid.layers.conv2d .. autofunction:: paddle.v2.fluid.layers.conv2d
:noindex: :noindex:
sequence_pool sequence_pool
--------- -------------
.. autofunction:: paddle.v2.fluid.layers.sequence_pool .. autofunction:: paddle.v2.fluid.layers.sequence_pool
:noindex: :noindex:
pool2d pool2d
--------- ------
.. autofunction:: paddle.v2.fluid.layers.pool2d .. autofunction:: paddle.v2.fluid.layers.pool2d
:noindex: :noindex:
batch_norm batch_norm
--------- ----------
.. autofunction:: paddle.v2.fluid.layers.batch_norm .. autofunction:: paddle.v2.fluid.layers.batch_norm
:noindex: :noindex:
beam_search_decode beam_search_decode
--------- ------------------
.. autofunction:: paddle.v2.fluid.layers.beam_search_decode .. autofunction:: paddle.v2.fluid.layers.beam_search_decode
:noindex: :noindex:
lod_rank_table lod_rank_table
--------- --------------
.. autofunction:: paddle.v2.fluid.layers.lod_rank_table .. autofunction:: paddle.v2.fluid.layers.lod_rank_table
:noindex: :noindex:
max_sequence_len max_sequence_len
--------- ----------------
.. autofunction:: paddle.v2.fluid.layers.max_sequence_len .. autofunction:: paddle.v2.fluid.layers.max_sequence_len
:noindex: :noindex:
topk topk
--------- -----
.. autofunction:: paddle.v2.fluid.layers.topk .. autofunction:: paddle.v2.fluid.layers.topk
:noindex: :noindex:
lod_tensor_to_array lod_tensor_to_array
--------- -------------------
.. autofunction:: paddle.v2.fluid.layers.lod_tensor_to_array .. autofunction:: paddle.v2.fluid.layers.lod_tensor_to_array
:noindex: :noindex:
array_to_lod_tensor array_to_lod_tensor
--------- -------------------
.. autofunction:: paddle.v2.fluid.layers.array_to_lod_tensor .. autofunction:: paddle.v2.fluid.layers.array_to_lod_tensor
:noindex: :noindex:
...@@ -222,26 +222,26 @@ array_to_lod_tensor ...@@ -222,26 +222,26 @@ array_to_lod_tensor
fill_constant fill_constant
--------- -------------
.. autofunction:: paddle.v2.fluid.layers.fill_constant .. autofunction:: paddle.v2.fluid.layers.fill_constant
:noindex: :noindex:
fill_constant_batch_size_like fill_constant_batch_size_like
--------- -----------------------------
.. autofunction:: paddle.v2.fluid.layers.fill_constant_batch_size_like .. autofunction:: paddle.v2.fluid.layers.fill_constant_batch_size_like
:noindex: :noindex:
ones ones
--------- ----
.. autofunction:: paddle.v2.fluid.layers.ones .. autofunction:: paddle.v2.fluid.layers.ones
:noindex: :noindex:
zeros zeros
--------- -----
.. autofunction:: paddle.v2.fluid.layers.zeros .. autofunction:: paddle.v2.fluid.layers.zeros
:noindex: :noindex:
...@@ -253,14 +253,14 @@ increment ...@@ -253,14 +253,14 @@ increment
array_write array_write
--------- -----------
.. autofunction:: paddle.v2.fluid.layers.array_write .. autofunction:: paddle.v2.fluid.layers.array_write
:noindex: :noindex:
create_array create_array
--------- ------------
.. autofunction:: paddle.v2.fluid.layers.create_array .. autofunction:: paddle.v2.fluid.layers.create_array
:noindex: :noindex:
...@@ -272,31 +272,31 @@ less_than ...@@ -272,31 +272,31 @@ less_than
array_read array_read
--------- ----------
.. autofunction:: paddle.v2.fluid.layers.array_read .. autofunction:: paddle.v2.fluid.layers.array_read
:noindex: :noindex:
shrink_memory shrink_memory
--------- --------------
.. autofunction:: paddle.v2.fluid.layers.shrink_memory .. autofunction:: paddle.v2.fluid.layers.shrink_memory
:noindex: :noindex:
array_length array_length
--------- -------------
.. autofunction:: paddle.v2.fluid.layers.array_length .. autofunction:: paddle.v2.fluid.layers.array_length
:noindex: :noindex:
conv2d_transpose conv2d_transpose
--------- ----------------
.. autofunction:: paddle.v2.fluid.layers.conv2d_transpose .. autofunction:: paddle.v2.fluid.layers.conv2d_transpose
:noindex: :noindex:
sequence_expand sequence_expand
--------- ---------------
.. autofunction:: paddle.v2.fluid.layers.sequence_expand .. autofunction:: paddle.v2.fluid.layers.sequence_expand
:noindex: :noindex:
...@@ -308,13 +308,13 @@ lstm_unit ...@@ -308,13 +308,13 @@ lstm_unit
sequence_softmax sequence_softmax
--------- ----------------
.. autofunction:: paddle.v2.fluid.layers.sequence_softmax .. autofunction:: paddle.v2.fluid.layers.sequence_softmax
:noindex: :noindex:
reduce_sum reduce_sum
--------- ----------
.. autofunction:: paddle.v2.fluid.layers.reduce_sum .. autofunction:: paddle.v2.fluid.layers.reduce_sum
:noindex: :noindex:
...@@ -3,19 +3,19 @@ Nets ...@@ -3,19 +3,19 @@ Nets
=========== ===========
simple_img_conv_pool simple_img_conv_pool
----------- --------------------
.. autofunction:: paddle.v2.fluid.nets.simple_img_conv_pool .. autofunction:: paddle.v2.fluid.nets.simple_img_conv_pool
:noindex: :noindex:
img_conv_group img_conv_group
----------- ---------------
.. autofunction:: paddle.v2.fluid.nets.img_conv_group .. autofunction:: paddle.v2.fluid.nets.img_conv_group
:noindex: :noindex:
sequence_conv_pool sequence_conv_pool
----------- ------------------
.. autofunction:: paddle.v2.fluid.nets.sequence_conv_pool .. autofunction:: paddle.v2.fluid.nets.sequence_conv_pool
:noindex: :noindex:
......
...@@ -18,7 +18,7 @@ SGDOptimizer ...@@ -18,7 +18,7 @@ SGDOptimizer
MomentumOptimizer MomentumOptimizer
----------- -----------------
.. automodule:: paddle.v2.fluid.optimizer .. automodule:: paddle.v2.fluid.optimizer
:members: MomentumOptimizer :members: MomentumOptimizer
:noindex: :noindex:
...@@ -26,14 +26,14 @@ MomentumOptimizer ...@@ -26,14 +26,14 @@ MomentumOptimizer
AdagradOptimizer AdagradOptimizer
----------- ----------------
.. automodule:: paddle.v2.fluid.optimizer .. automodule:: paddle.v2.fluid.optimizer
:members: AdagradOptimizer :members: AdagradOptimizer
:noindex: :noindex:
AdamOptimizer AdamOptimizer
----------- -------------
.. automodule:: paddle.v2.fluid.optimizer .. automodule:: paddle.v2.fluid.optimizer
:members: AdamOptimizer :members: AdamOptimizer
:noindex: :noindex:
...@@ -47,7 +47,7 @@ AdamaxOptimizer ...@@ -47,7 +47,7 @@ AdamaxOptimizer
DecayedAdagradOptimizer DecayedAdagradOptimizer
----------- -----------------------
.. automodule:: paddle.v2.fluid.optimizer .. automodule:: paddle.v2.fluid.optimizer
:members: DecayedAdagradOptimizer :members: DecayedAdagradOptimizer
:noindex: :noindex:
......
...@@ -3,14 +3,14 @@ Regularizer ...@@ -3,14 +3,14 @@ Regularizer
=========== ===========
WeightDecayRegularizer WeightDecayRegularizer
----------- ----------------------
.. automodule:: paddle.v2.fluid.regularizer .. automodule:: paddle.v2.fluid.regularizer
:members: WeightDecayRegularizer :members: WeightDecayRegularizer
:noindex: :noindex:
L2DecayRegularizer L2DecayRegularizer
----------- ------------------
.. automodule:: paddle.v2.fluid.regularizer .. automodule:: paddle.v2.fluid.regularizer
:members: L2DecayRegularizer :members: L2DecayRegularizer
:noindex: :noindex:
...@@ -18,7 +18,7 @@ L2DecayRegularizer ...@@ -18,7 +18,7 @@ L2DecayRegularizer
L1DecayRegularizer L1DecayRegularizer
----------- -------------------
.. automodule:: paddle.v2.fluid.regularizer .. automodule:: paddle.v2.fluid.regularizer
:members: L1DecayRegularizer :members: L1DecayRegularizer
......
...@@ -222,55 +222,83 @@ ...@@ -222,55 +222,83 @@
<dl class="function"> <dl class="function">
<dt> <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> <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> <dd><blockquote>
<p>This layer accepts multiple inputs and applies a linear transformation to each input. <div><p><strong>Fully Connected Layer</strong></p>
If activation type is provided, the corresponding activation function is applied to the <p>The fully connected layer can take multiple tensors as its inputs. It
output of the linear transformation. For each input <span class="math">\(X\)</span>, the equation is:</p> 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"> <div class="math">
\[Out = Act(WX + b)\]</div> \[Out = Act\left({\sum_{i=0}^{N-1}W_iX_i + 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>
</div></blockquote> </div></blockquote>
<p>All the input variables are passed in as local variables to the LayerHelper <p>ight)</p>
constructor.</p> <blockquote>
<table class="docutils field-list" frame="void" rules="none"> <div><p>In the above equation:</p>
<col class="field-name" /> <ul class="simple">
<col class="field-body" /> <li><span class="math">\(N\)</span>: Number of the input.</li>
<tbody valign="top"> <li><span class="math">\(X_i\)</span>: The input tensor.</li>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><span class="math">\(W\)</span>: The weights created by this layer.</li>
<li><strong>input</strong> (<em>Variable|list</em>) &#8211; Input tensors. Each tensor has a rank of atleast 2</li> <li><span class="math">\(b\)</span>: The bias parameter created by this layer (if needed).</li>
<li><strong>size</strong> (<em>int</em>) &#8211; Output size</li> <li><span class="math">\(Act\)</span>: The activation funtion.</li>
<li><strong>num_flatten_dims</strong> (<em>int</em>) &#8211; Number of columns in input</li> <li><span class="math">\(Out\)</span>: The output tensor.</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>
</ul> </ul>
</td> <dl class="docutils">
</tr> <dt>Args:</dt>
<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> <dd><p class="first">input(Variable|list): The input tensor(s) to the fully connected layer.
</td> size(int): The number of output units in the fully connected layer.
</tr> num_flatten_dims(int): The fc layer can accept an input tensor with more</p>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">Variable</p> <blockquote>
</td> <div>than two dimensions. If this happens, the
</tr> multidimensional tensor will first be flattened
<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> into a 2-dimensional matrix. The parameter
</td> <cite>num_flatten_dims</cite> determines how the input tensor
</tr> is flattened: the first <cite>num_flatten_dims</cite>
</tbody> dimensions will be flatten to form the first
</table> dimension of the final matrix (height of the
<p class="rubric">Examples</p> matrix), and the rest <cite>rank(X) - num_col_dims</cite>
<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> 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> <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> </pre></div>
</div> </div>
</dd>
</dl>
</div></blockquote>
</dd></dl> </dd></dl>
</div> </div>
...@@ -392,32 +420,45 @@ Duplicable: False Optional: False</td> ...@@ -392,32 +420,45 @@ Duplicable: False Optional: False</td>
<dt> <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> <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> <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> <p>The equation is:</p>
<blockquote> <blockquote>
<div>$$Out = X * Y$$</div></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, <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 <cite>X</cite>.</p> or not. But the output only shares the LoD information with input $X$.</p>
<table class="docutils field-list" frame="void" rules="none"> <table class="docutils field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <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> 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> 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>, <li><strong>x_num_col_dims</strong> (<em>INT</em>) &#8211; (int, default 1), The mul_op can take tensors with more than two
in that case, tensors will be reshaped to a matrix. The matrix&#8217;s first dimensions as its inputs. If the input $X$ is a tensor with more
dimension(column length) will be the product of tensor&#8217;s last than two dimensions, $X$ will be flattened into a two-dimensional
<cite>num_col_dims</cite> dimensions, and the matrix&#8217;s second dimension(row length) matrix first. The flattening rule is: the first <cite>num_col_dims</cite>
will be the product of tensor&#8217;s first <cite>rank - num_col_dims</cite> dimensions.</li> will be flattened to form the first dimension of the final matrix
<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>, (the height of the matrix), and the rest <cite>rank(X) - num_col_dims</cite>
in that case, tensors will be reshaped to a matrix. Just like input <cite>X</cite>.</li> 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> </ul>
</td> </td>
</tr> </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> </td>
</tr> </tr>
</tbody> </tbody>
......
...@@ -241,9 +241,9 @@ of its implementations</p> ...@@ -241,9 +241,9 @@ of its implementations</p>
</dd></dl> </dd></dl>
</div> </div>
<div class="section" id="l1decayregularizer"> <div class="section" id="module-paddle.v2.fluid.regularizer">
<h2>L1DecayRegularizer<a class="headerlink" href="#l1decayregularizer" title="Permalink to this headline"></a></h2> <span id="l1decayregularizer"></span><h2>L1DecayRegularizer<a class="headerlink" href="#module-paddle.v2.fluid.regularizer" title="Permalink to this headline"></a></h2>
<span class="target" id="module-paddle.v2.fluid.regularizer"></span><dl class="class"> <dl class="class">
<dt id="paddle.v2.fluid.regularizer.L1DecayRegularizer"> <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> <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><p>Implements the L1 Weight Decay Regularization</p>
......
...@@ -1212,23 +1212,23 @@ ...@@ -1212,23 +1212,23 @@
} ] } ]
},{ },{
"type" : "mul", "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" : [ "inputs" : [
{ {
"name" : "X", "name" : "X",
"comment" : "The first input of mul op", "comment" : "(Tensor), The first input tensor of mul op.",
"duplicable" : 0, "duplicable" : 0,
"intermediate" : 0 "intermediate" : 0
}, { }, {
"name" : "Y", "name" : "Y",
"comment" : "The second input of mul op", "comment" : "(Tensor), The second input tensor of mul op.",
"duplicable" : 0, "duplicable" : 0,
"intermediate" : 0 "intermediate" : 0
} ], } ],
"outputs" : [ "outputs" : [
{ {
"name" : "Out", "name" : "Out",
"comment" : "The output of mul op", "comment" : "(Tensor), The output tensor of mul op.",
"duplicable" : 0, "duplicable" : 0,
"intermediate" : 0 "intermediate" : 0
} ], } ],
...@@ -1236,12 +1236,12 @@ ...@@ -1236,12 +1236,12 @@
{ {
"name" : "x_num_col_dims", "name" : "x_num_col_dims",
"type" : "int", "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 "generated" : 0
}, { }, {
"name" : "y_num_col_dims", "name" : "y_num_col_dims",
"type" : "int", "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 "generated" : 0
} ] } ]
},{ },{
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -467,7 +467,7 @@ lambda_cost ...@@ -467,7 +467,7 @@ lambda_cost
:noindex: :noindex:
square_error_cost square_error_cost
-------- -----------------
.. autoclass:: paddle.v2.layer.square_error_cost .. autoclass:: paddle.v2.layer.square_error_cost
:noindex: :noindex:
...@@ -533,7 +533,7 @@ Miscs ...@@ -533,7 +533,7 @@ Miscs
===== =====
dropout dropout
-------------- --------
.. autoclass:: paddle.v2.layer.dropout .. autoclass:: paddle.v2.layer.dropout
:noindex: :noindex:
......
...@@ -19,17 +19,17 @@ dynamic_lstm ...@@ -19,17 +19,17 @@ dynamic_lstm
:noindex: :noindex:
data data
--------- ----
.. autofunction:: paddle.v2.fluid.layers.data .. autofunction:: paddle.v2.fluid.layers.data
:noindex: :noindex:
mean mean
--------- ----
.. autofunction:: paddle.v2.fluid.layers.mean .. autofunction:: paddle.v2.fluid.layers.mean
:noindex: :noindex:
mul mul
--------- ---
.. autofunction:: paddle.v2.fluid.layers.mul .. autofunction:: paddle.v2.fluid.layers.mul
:noindex: :noindex:
...@@ -45,13 +45,13 @@ elementwise_div ...@@ -45,13 +45,13 @@ elementwise_div
dropout dropout
--------- -------
.. autofunction:: paddle.v2.fluid.layers.dropout .. autofunction:: paddle.v2.fluid.layers.dropout
:noindex: :noindex:
reshape reshape
--------- --------
.. autofunction:: paddle.v2.fluid.layers.reshape .. autofunction:: paddle.v2.fluid.layers.reshape
:noindex: :noindex:
...@@ -81,67 +81,67 @@ transpose ...@@ -81,67 +81,67 @@ transpose
sigmoid_cross_entropy_with_logits sigmoid_cross_entropy_with_logits
--------- ---------------------------------
.. autofunction:: paddle.v2.fluid.layers.esigmoid_cross_entropy_with_logits .. autofunction:: paddle.v2.fluid.layers.esigmoid_cross_entropy_with_logits
:noindex: :noindex:
cast cast
--------- ----
.. autofunction:: paddle.v2.fluid.layers.cast .. autofunction:: paddle.v2.fluid.layers.cast
:noindex: :noindex:
concat concat
--------- -------
.. autofunction:: paddle.v2.fluid.layers.concat .. autofunction:: paddle.v2.fluid.layers.concat
:noindex: :noindex:
sums sums
--------- ----
.. autofunction:: paddle.v2.fluid.layers.sums .. autofunction:: paddle.v2.fluid.layers.sums
:noindex: :noindex:
linear_chain_crf linear_chain_crf
--------- ----------------
.. autofunction:: paddle.v2.fluid.layers.linear_chain_crf .. autofunction:: paddle.v2.fluid.layers.linear_chain_crf
:noindex: :noindex:
assign assign
--------- -------
.. autofunction:: paddle.v2.fluid.layers.embedding .. autofunction:: paddle.v2.fluid.layers.embedding
:noindex: :noindex:
split_lod_tensor split_lod_tensor
--------- ----------------
.. autofunction:: paddle.v2.fluid.layers.split_lod_tensor .. autofunction:: paddle.v2.fluid.layers.split_lod_tensor
:noindex: :noindex:
merge_lod_tensor merge_lod_tensor
--------- ----------------
.. autofunction:: paddle.v2.fluid.layers.merge_lod_tensor .. autofunction:: paddle.v2.fluid.layers.merge_lod_tensor
:noindex: :noindex:
cos_sim cos_sim
--------- --------
.. autofunction:: paddle.v2.fluid.layers.cos_sim .. autofunction:: paddle.v2.fluid.layers.cos_sim
:noindex: :noindex:
cross_entropy cross_entropy
--------- -------------
.. autofunction:: paddle.v2.fluid.layers.cross_entropy .. autofunction:: paddle.v2.fluid.layers.cross_entropy
:noindex: :noindex:
square_error_cost square_error_cost
--------- -----------------
.. autofunction:: paddle.v2.fluid.layers.square_error_cost .. autofunction:: paddle.v2.fluid.layers.square_error_cost
:noindex: :noindex:
...@@ -153,68 +153,68 @@ accuracy ...@@ -153,68 +153,68 @@ accuracy
sequence_conv sequence_conv
--------- -------------
.. autofunction:: paddle.v2.fluid.layers.sequence_conv .. autofunction:: paddle.v2.fluid.layers.sequence_conv
:noindex: :noindex:
conv2d conv2d
--------- ------
.. autofunction:: paddle.v2.fluid.layers.conv2d .. autofunction:: paddle.v2.fluid.layers.conv2d
:noindex: :noindex:
sequence_pool sequence_pool
--------- -------------
.. autofunction:: paddle.v2.fluid.layers.sequence_pool .. autofunction:: paddle.v2.fluid.layers.sequence_pool
:noindex: :noindex:
pool2d pool2d
--------- ------
.. autofunction:: paddle.v2.fluid.layers.pool2d .. autofunction:: paddle.v2.fluid.layers.pool2d
:noindex: :noindex:
batch_norm batch_norm
--------- ----------
.. autofunction:: paddle.v2.fluid.layers.batch_norm .. autofunction:: paddle.v2.fluid.layers.batch_norm
:noindex: :noindex:
beam_search_decode beam_search_decode
--------- ------------------
.. autofunction:: paddle.v2.fluid.layers.beam_search_decode .. autofunction:: paddle.v2.fluid.layers.beam_search_decode
:noindex: :noindex:
lod_rank_table lod_rank_table
--------- --------------
.. autofunction:: paddle.v2.fluid.layers.lod_rank_table .. autofunction:: paddle.v2.fluid.layers.lod_rank_table
:noindex: :noindex:
max_sequence_len max_sequence_len
--------- ----------------
.. autofunction:: paddle.v2.fluid.layers.max_sequence_len .. autofunction:: paddle.v2.fluid.layers.max_sequence_len
:noindex: :noindex:
topk topk
--------- -----
.. autofunction:: paddle.v2.fluid.layers.topk .. autofunction:: paddle.v2.fluid.layers.topk
:noindex: :noindex:
lod_tensor_to_array lod_tensor_to_array
--------- -------------------
.. autofunction:: paddle.v2.fluid.layers.lod_tensor_to_array .. autofunction:: paddle.v2.fluid.layers.lod_tensor_to_array
:noindex: :noindex:
array_to_lod_tensor array_to_lod_tensor
--------- -------------------
.. autofunction:: paddle.v2.fluid.layers.array_to_lod_tensor .. autofunction:: paddle.v2.fluid.layers.array_to_lod_tensor
:noindex: :noindex:
...@@ -222,26 +222,26 @@ array_to_lod_tensor ...@@ -222,26 +222,26 @@ array_to_lod_tensor
fill_constant fill_constant
--------- -------------
.. autofunction:: paddle.v2.fluid.layers.fill_constant .. autofunction:: paddle.v2.fluid.layers.fill_constant
:noindex: :noindex:
fill_constant_batch_size_like fill_constant_batch_size_like
--------- -----------------------------
.. autofunction:: paddle.v2.fluid.layers.fill_constant_batch_size_like .. autofunction:: paddle.v2.fluid.layers.fill_constant_batch_size_like
:noindex: :noindex:
ones ones
--------- ----
.. autofunction:: paddle.v2.fluid.layers.ones .. autofunction:: paddle.v2.fluid.layers.ones
:noindex: :noindex:
zeros zeros
--------- -----
.. autofunction:: paddle.v2.fluid.layers.zeros .. autofunction:: paddle.v2.fluid.layers.zeros
:noindex: :noindex:
...@@ -253,14 +253,14 @@ increment ...@@ -253,14 +253,14 @@ increment
array_write array_write
--------- -----------
.. autofunction:: paddle.v2.fluid.layers.array_write .. autofunction:: paddle.v2.fluid.layers.array_write
:noindex: :noindex:
create_array create_array
--------- ------------
.. autofunction:: paddle.v2.fluid.layers.create_array .. autofunction:: paddle.v2.fluid.layers.create_array
:noindex: :noindex:
...@@ -272,31 +272,31 @@ less_than ...@@ -272,31 +272,31 @@ less_than
array_read array_read
--------- ----------
.. autofunction:: paddle.v2.fluid.layers.array_read .. autofunction:: paddle.v2.fluid.layers.array_read
:noindex: :noindex:
shrink_memory shrink_memory
--------- --------------
.. autofunction:: paddle.v2.fluid.layers.shrink_memory .. autofunction:: paddle.v2.fluid.layers.shrink_memory
:noindex: :noindex:
array_length array_length
--------- -------------
.. autofunction:: paddle.v2.fluid.layers.array_length .. autofunction:: paddle.v2.fluid.layers.array_length
:noindex: :noindex:
conv2d_transpose conv2d_transpose
--------- ----------------
.. autofunction:: paddle.v2.fluid.layers.conv2d_transpose .. autofunction:: paddle.v2.fluid.layers.conv2d_transpose
:noindex: :noindex:
sequence_expand sequence_expand
--------- ---------------
.. autofunction:: paddle.v2.fluid.layers.sequence_expand .. autofunction:: paddle.v2.fluid.layers.sequence_expand
:noindex: :noindex:
...@@ -308,13 +308,13 @@ lstm_unit ...@@ -308,13 +308,13 @@ lstm_unit
sequence_softmax sequence_softmax
--------- ----------------
.. autofunction:: paddle.v2.fluid.layers.sequence_softmax .. autofunction:: paddle.v2.fluid.layers.sequence_softmax
:noindex: :noindex:
reduce_sum reduce_sum
--------- ----------
.. autofunction:: paddle.v2.fluid.layers.reduce_sum .. autofunction:: paddle.v2.fluid.layers.reduce_sum
:noindex: :noindex:
...@@ -3,19 +3,19 @@ Nets ...@@ -3,19 +3,19 @@ Nets
=========== ===========
simple_img_conv_pool simple_img_conv_pool
----------- --------------------
.. autofunction:: paddle.v2.fluid.nets.simple_img_conv_pool .. autofunction:: paddle.v2.fluid.nets.simple_img_conv_pool
:noindex: :noindex:
img_conv_group img_conv_group
----------- ---------------
.. autofunction:: paddle.v2.fluid.nets.img_conv_group .. autofunction:: paddle.v2.fluid.nets.img_conv_group
:noindex: :noindex:
sequence_conv_pool sequence_conv_pool
----------- ------------------
.. autofunction:: paddle.v2.fluid.nets.sequence_conv_pool .. autofunction:: paddle.v2.fluid.nets.sequence_conv_pool
:noindex: :noindex:
......
...@@ -18,7 +18,7 @@ SGDOptimizer ...@@ -18,7 +18,7 @@ SGDOptimizer
MomentumOptimizer MomentumOptimizer
----------- -----------------
.. automodule:: paddle.v2.fluid.optimizer .. automodule:: paddle.v2.fluid.optimizer
:members: MomentumOptimizer :members: MomentumOptimizer
:noindex: :noindex:
...@@ -26,14 +26,14 @@ MomentumOptimizer ...@@ -26,14 +26,14 @@ MomentumOptimizer
AdagradOptimizer AdagradOptimizer
----------- ----------------
.. automodule:: paddle.v2.fluid.optimizer .. automodule:: paddle.v2.fluid.optimizer
:members: AdagradOptimizer :members: AdagradOptimizer
:noindex: :noindex:
AdamOptimizer AdamOptimizer
----------- -------------
.. automodule:: paddle.v2.fluid.optimizer .. automodule:: paddle.v2.fluid.optimizer
:members: AdamOptimizer :members: AdamOptimizer
:noindex: :noindex:
...@@ -47,7 +47,7 @@ AdamaxOptimizer ...@@ -47,7 +47,7 @@ AdamaxOptimizer
DecayedAdagradOptimizer DecayedAdagradOptimizer
----------- -----------------------
.. automodule:: paddle.v2.fluid.optimizer .. automodule:: paddle.v2.fluid.optimizer
:members: DecayedAdagradOptimizer :members: DecayedAdagradOptimizer
:noindex: :noindex:
......
...@@ -3,14 +3,14 @@ Regularizer ...@@ -3,14 +3,14 @@ Regularizer
=========== ===========
WeightDecayRegularizer WeightDecayRegularizer
----------- ----------------------
.. automodule:: paddle.v2.fluid.regularizer .. automodule:: paddle.v2.fluid.regularizer
:members: WeightDecayRegularizer :members: WeightDecayRegularizer
:noindex: :noindex:
L2DecayRegularizer L2DecayRegularizer
----------- ------------------
.. automodule:: paddle.v2.fluid.regularizer .. automodule:: paddle.v2.fluid.regularizer
:members: L2DecayRegularizer :members: L2DecayRegularizer
:noindex: :noindex:
...@@ -18,7 +18,7 @@ L2DecayRegularizer ...@@ -18,7 +18,7 @@ L2DecayRegularizer
L1DecayRegularizer L1DecayRegularizer
----------- -------------------
.. automodule:: paddle.v2.fluid.regularizer .. automodule:: paddle.v2.fluid.regularizer
:members: L1DecayRegularizer :members: L1DecayRegularizer
......
...@@ -235,55 +235,83 @@ ...@@ -235,55 +235,83 @@
<dl class="function"> <dl class="function">
<dt> <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> <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> <dd><blockquote>
<p>This layer accepts multiple inputs and applies a linear transformation to each input. <div><p><strong>Fully Connected Layer</strong></p>
If activation type is provided, the corresponding activation function is applied to the <p>The fully connected layer can take multiple tensors as its inputs. It
output of the linear transformation. For each input <span class="math">\(X\)</span>, the equation is:</p> 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"> <div class="math">
\[Out = Act(WX + b)\]</div> \[Out = Act\left({\sum_{i=0}^{N-1}W_iX_i + 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>
</div></blockquote> </div></blockquote>
<p>All the input variables are passed in as local variables to the LayerHelper <p>ight)</p>
constructor.</p> <blockquote>
<table class="docutils field-list" frame="void" rules="none"> <div><p>In the above equation:</p>
<col class="field-name" /> <ul class="simple">
<col class="field-body" /> <li><span class="math">\(N\)</span>: Number of the input.</li>
<tbody valign="top"> <li><span class="math">\(X_i\)</span>: The input tensor.</li>
<tr class="field-odd field"><th class="field-name">参数:</th><td class="field-body"><ul class="first simple"> <li><span class="math">\(W\)</span>: The weights created by this layer.</li>
<li><strong>input</strong> (<em>Variable|list</em>) &#8211; Input tensors. Each tensor has a rank of atleast 2</li> <li><span class="math">\(b\)</span>: The bias parameter created by this layer (if needed).</li>
<li><strong>size</strong> (<em>int</em>) &#8211; Output size</li> <li><span class="math">\(Act\)</span>: The activation funtion.</li>
<li><strong>num_flatten_dims</strong> (<em>int</em>) &#8211; Number of columns in input</li> <li><span class="math">\(Out\)</span>: The output tensor.</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>
</ul> </ul>
</td> <dl class="docutils">
</tr> <dt>Args:</dt>
<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> <dd><p class="first">input(Variable|list): The input tensor(s) to the fully connected layer.
</td> size(int): The number of output units in the fully connected layer.
</tr> num_flatten_dims(int): The fc layer can accept an input tensor with more</p>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first">Variable</p> <blockquote>
</td> <div>than two dimensions. If this happens, the
</tr> multidimensional tensor will first be flattened
<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> into a 2-dimensional matrix. The parameter
</td> <cite>num_flatten_dims</cite> determines how the input tensor
</tr> is flattened: the first <cite>num_flatten_dims</cite>
</tbody> dimensions will be flatten to form the first
</table> dimension of the final matrix (height of the
<p class="rubric">Examples</p> matrix), and the rest <cite>rank(X) - num_col_dims</cite>
<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> 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> <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> </pre></div>
</div> </div>
</dd>
</dl>
</div></blockquote>
</dd></dl> </dd></dl>
</div> </div>
...@@ -405,32 +433,45 @@ Duplicable: False Optional: False</td> ...@@ -405,32 +433,45 @@ Duplicable: False Optional: False</td>
<dt> <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> <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> <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> <p>The equation is:</p>
<blockquote> <blockquote>
<div>$$Out = X * Y$$</div></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, <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 <cite>X</cite>.</p> or not. But the output only shares the LoD information with input $X$.</p>
<table class="docutils field-list" frame="void" rules="none"> <table class="docutils field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <tbody valign="top">
<tr class="field-odd field"><th class="field-name">参数:</th><td class="field-body"><ul class="first simple"> <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> 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> 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>, <li><strong>x_num_col_dims</strong> (<em>INT</em>) &#8211; (int, default 1), The mul_op can take tensors with more than two
in that case, tensors will be reshaped to a matrix. The matrix&#8217;s first dimensions as its inputs. If the input $X$ is a tensor with more
dimension(column length) will be the product of tensor&#8217;s last than two dimensions, $X$ will be flattened into a two-dimensional
<cite>num_col_dims</cite> dimensions, and the matrix&#8217;s second dimension(row length) matrix first. The flattening rule is: the first <cite>num_col_dims</cite>
will be the product of tensor&#8217;s first <cite>rank - num_col_dims</cite> dimensions.</li> will be flattened to form the first dimension of the final matrix
<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>, (the height of the matrix), and the rest <cite>rank(X) - num_col_dims</cite>
in that case, tensors will be reshaped to a matrix. Just like input <cite>X</cite>.</li> 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> </ul>
</td> </td>
</tr> </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> </td>
</tr> </tr>
</tbody> </tbody>
......
...@@ -254,9 +254,9 @@ of its implementations</p> ...@@ -254,9 +254,9 @@ of its implementations</p>
</dd></dl> </dd></dl>
</div> </div>
<div class="section" id="l1decayregularizer"> <div class="section" id="module-paddle.v2.fluid.regularizer">
<h2>L1DecayRegularizer<a class="headerlink" href="#l1decayregularizer" title="永久链接至标题"></a></h2> <span id="l1decayregularizer"></span><h2>L1DecayRegularizer<a class="headerlink" href="#module-paddle.v2.fluid.regularizer" title="永久链接至标题"></a></h2>
<span class="target" id="module-paddle.v2.fluid.regularizer"></span><dl class="class"> <dl class="class">
<dt id="paddle.v2.fluid.regularizer.L1DecayRegularizer"> <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> <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><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.
先完成此消息的编辑!
想要评论请 注册