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

Deploy to GitHub Pages: 04806ffe

上级 e8093608
...@@ -2601,8 +2601,9 @@ will be named automatically.</li> ...@@ -2601,8 +2601,9 @@ will be named automatically.</li>
<dl class="function"> <dl class="function">
<dt> <dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">matmul</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>transpose_x=False</em>, <em>transpose_y=False</em>, <em>name=None</em><span class="sig-paren">)</span></dt> <code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">matmul</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>transpose_x=False</em>, <em>transpose_y=False</em>, <em>name=None</em><span class="sig-paren">)</span></dt>
<dd><p>Applies matrix multipication to two tensors. Currently only rank 1 to rank <dd><p>Applies matrix multiplication to two tensors. Currently, the input
3 input tensors are supported.</p> tensors&#8217; rank can be any, but when the rank of anyone inputs is
bigger than 3, this two inputs&#8217; rank should be equal.</p>
<p>The actual behavior depends on the shapes of <span class="math">\(x\)</span>, <span class="math">\(y\)</span> and the <p>The actual behavior depends on the shapes of <span class="math">\(x\)</span>, <span class="math">\(y\)</span> and the
flag values of <code class="xref py py-attr docutils literal"><span class="pre">transpose_x</span></code>, <code class="xref py py-attr docutils literal"><span class="pre">transpose_y</span></code>. Specifically:</p> flag values of <code class="xref py py-attr docutils literal"><span class="pre">transpose_x</span></code>, <code class="xref py py-attr docutils literal"><span class="pre">transpose_y</span></code>. Specifically:</p>
<ul class="simple"> <ul class="simple">
...@@ -2612,10 +2613,10 @@ are transposed. If the tensor is rank-1 of shape <span class="math">\([D]\)</spa ...@@ -2612,10 +2613,10 @@ are transposed. If the tensor is rank-1 of shape <span class="math">\([D]\)</spa
<span class="math">\([D, 1]\)</span> in transposed form, whereas for <span class="math">\(y\)</span> it is the <span class="math">\([D, 1]\)</span> in transposed form, whereas for <span class="math">\(y\)</span> it is the
opposite: It is treated as <span class="math">\([D, 1]\)</span> in nontransposed form and as opposite: It is treated as <span class="math">\([D, 1]\)</span> in nontransposed form and as
<span class="math">\([1, D]\)</span> in transposed form.</li> <span class="math">\([1, D]\)</span> in transposed form.</li>
<li>After transpose, the two tensors are 2-D or 3-D and matrix multipication <li>After transpose, the two tensors are 2-D or n-D and matrix multiplication
performs in the following way.<ul> performs in the following way.<ul>
<li>If both are 2-D, they are multiplied like conventional matrices.</li> <li>If both are 2-D, they are multiplied like conventional matrices.</li>
<li>If either is 3-D, it is treated as a stack of matrices residing in the <li>If either is n-D, it is treated as a stack of matrices residing in the
last two dimensions and a batched matrix multiply supporting broadcast last two dimensions and a batched matrix multiply supporting broadcast
applies on the two tensors.</li> applies on the two tensors.</li>
</ul> </ul>
...@@ -2623,7 +2624,7 @@ applies on the two tensors.</li> ...@@ -2623,7 +2624,7 @@ applies on the two tensors.</li>
</ul> </ul>
<p>Also note that if the raw tensor <span class="math">\(x\)</span> or <span class="math">\(y\)</span> is rank-1 and <p>Also note that if the raw tensor <span class="math">\(x\)</span> or <span class="math">\(y\)</span> is rank-1 and
nontransposed, the prepended or appended dimension <span class="math">\(1\)</span> will be nontransposed, the prepended or appended dimension <span class="math">\(1\)</span> will be
removed after matrix multipication.</p> removed after matrix multiplication.</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" />
...@@ -2648,6 +2649,8 @@ will be named automatically.</li> ...@@ -2648,6 +2649,8 @@ will be named automatically.</li>
</table> </table>
<p class="rubric">Examples</p> <p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="c1"># Examples to clarify shapes of the inputs and output</span> <div class="highlight-python"><div class="highlight"><pre><span></span><span class="c1"># Examples to clarify shapes of the inputs and output</span>
<span class="c1"># x: [B, ..., M, K], y: [B, ..., K, N]</span>
<span class="n">fluid</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="c1"># out: [B, ..., M, N]</span>
<span class="c1"># x: [B, M, K], y: [B, K, N]</span> <span class="c1"># x: [B, M, K], y: [B, K, N]</span>
<span class="n">fluid</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="c1"># out: [B, M, N]</span> <span class="n">fluid</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="c1"># out: [B, M, N]</span>
<span class="c1"># x: [B, M, K], y: [K, N]</span> <span class="c1"># x: [B, M, K], y: [K, N]</span>
......
...@@ -4120,7 +4120,7 @@ ...@@ -4120,7 +4120,7 @@
} ] } ]
},{ },{
"type" : "matmul", "type" : "matmul",
"comment" : "\nMatMul Operator.\n\n\nThis operator is used to perform (batched) matrix multiplication\nover the last two dimensions of the input tensors `X` and `Y`.\n\nIf a transpose flag is specified, the last two dimensions of the\ntensor are transposed. If the tensor is rank-1 of shape [D], then\nfor `X` it is treated as [1, D] in nontransposed form and as [D, 1]\nin transposed form, whereas for `Y` it is the opposite: It is treated\nas [D, 1] in nontransposed form and as [1, D] in transposed form.\n\nExamples without transpose:\n- X: [K], Y: [K] => Out: [1]\n- X: [K], Y: [K, N] => Out: [N]\n- X: [B, M, K], Y: [K] => Out: [B, M]\n- X: [M, K], Y: [B, K, N] => Out: [B, M, N]\n- X: [B, M, K], Y: [B, K, N] => Out: [B, M, N]\n\nThe behavior is designed to be similar to the `numpy.matmul` function.\nThe differences are:\n- Currently only rank 1 to rank 3 input tensors are supported.\n- We add `transpose_X` and `transpose_Y` flags.\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" : "\nMatMul Operator.\n\n\nThis operator is used to perform (batched) matrix multiplication\nover the last two dimensions of the input tensors `X` and `Y`.\n\nIf a transpose flag is specified, the last two dimensions of the\ntensor are transposed. If the tensor is rank-1 of shape [D], then\nfor `X` it is treated as [1, D] in nontransposed form and as [D, 1]\nin transposed form, whereas for `Y` it is the opposite: It is treated\nas [D, 1] in nontransposed form and as [1, D] in transposed form.\n\nExamples without transpose:\n- X: [K], Y: [K] => Out: [1]\n- X: [K], Y: [K, N] => Out: [N]\n- X: [B, M, K], Y: [K] => Out: [B, M]\n- X: [M, K], Y: [B, K, N] => Out: [B, M, N]\n- X: [B, M, K], Y: [B, K, N] => Out: [B, M, N]\n- X: [B, ..., M, K], Y: [B, ..., K, N] => Out: [B, ..., M, N]\n\nThe behavior is designed to be similar to the `numpy.matmul` function.\nThe differences are:\n- When the rank of the input data is less than or equal to 3, it\n is similar to the `numpy.matmul` function.\n- When the rank of the input is greater than 3, the rank of X and\n Y must be equal, and the first `rank - 2` dimensions must be equal.\n- We add `transpose_X` and `transpose_Y` flags.\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",
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -2620,8 +2620,9 @@ will be named automatically.</li> ...@@ -2620,8 +2620,9 @@ will be named automatically.</li>
<dl class="function"> <dl class="function">
<dt> <dt>
<code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">matmul</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>transpose_x=False</em>, <em>transpose_y=False</em>, <em>name=None</em><span class="sig-paren">)</span></dt> <code class="descclassname">paddle.v2.fluid.layers.</code><code class="descname">matmul</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>transpose_x=False</em>, <em>transpose_y=False</em>, <em>name=None</em><span class="sig-paren">)</span></dt>
<dd><p>Applies matrix multipication to two tensors. Currently only rank 1 to rank <dd><p>Applies matrix multiplication to two tensors. Currently, the input
3 input tensors are supported.</p> tensors&#8217; rank can be any, but when the rank of anyone inputs is
bigger than 3, this two inputs&#8217; rank should be equal.</p>
<p>The actual behavior depends on the shapes of <span class="math">\(x\)</span>, <span class="math">\(y\)</span> and the <p>The actual behavior depends on the shapes of <span class="math">\(x\)</span>, <span class="math">\(y\)</span> and the
flag values of <code class="xref py py-attr docutils literal"><span class="pre">transpose_x</span></code>, <code class="xref py py-attr docutils literal"><span class="pre">transpose_y</span></code>. Specifically:</p> flag values of <code class="xref py py-attr docutils literal"><span class="pre">transpose_x</span></code>, <code class="xref py py-attr docutils literal"><span class="pre">transpose_y</span></code>. Specifically:</p>
<ul class="simple"> <ul class="simple">
...@@ -2631,10 +2632,10 @@ are transposed. If the tensor is rank-1 of shape <span class="math">\([D]\)</spa ...@@ -2631,10 +2632,10 @@ are transposed. If the tensor is rank-1 of shape <span class="math">\([D]\)</spa
<span class="math">\([D, 1]\)</span> in transposed form, whereas for <span class="math">\(y\)</span> it is the <span class="math">\([D, 1]\)</span> in transposed form, whereas for <span class="math">\(y\)</span> it is the
opposite: It is treated as <span class="math">\([D, 1]\)</span> in nontransposed form and as opposite: It is treated as <span class="math">\([D, 1]\)</span> in nontransposed form and as
<span class="math">\([1, D]\)</span> in transposed form.</li> <span class="math">\([1, D]\)</span> in transposed form.</li>
<li>After transpose, the two tensors are 2-D or 3-D and matrix multipication <li>After transpose, the two tensors are 2-D or n-D and matrix multiplication
performs in the following way.<ul> performs in the following way.<ul>
<li>If both are 2-D, they are multiplied like conventional matrices.</li> <li>If both are 2-D, they are multiplied like conventional matrices.</li>
<li>If either is 3-D, it is treated as a stack of matrices residing in the <li>If either is n-D, it is treated as a stack of matrices residing in the
last two dimensions and a batched matrix multiply supporting broadcast last two dimensions and a batched matrix multiply supporting broadcast
applies on the two tensors.</li> applies on the two tensors.</li>
</ul> </ul>
...@@ -2642,7 +2643,7 @@ applies on the two tensors.</li> ...@@ -2642,7 +2643,7 @@ applies on the two tensors.</li>
</ul> </ul>
<p>Also note that if the raw tensor <span class="math">\(x\)</span> or <span class="math">\(y\)</span> is rank-1 and <p>Also note that if the raw tensor <span class="math">\(x\)</span> or <span class="math">\(y\)</span> is rank-1 and
nontransposed, the prepended or appended dimension <span class="math">\(1\)</span> will be nontransposed, the prepended or appended dimension <span class="math">\(1\)</span> will be
removed after matrix multipication.</p> removed after matrix multiplication.</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" />
...@@ -2667,6 +2668,8 @@ will be named automatically.</li> ...@@ -2667,6 +2668,8 @@ will be named automatically.</li>
</table> </table>
<p class="rubric">Examples</p> <p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="c1"># Examples to clarify shapes of the inputs and output</span> <div class="highlight-python"><div class="highlight"><pre><span></span><span class="c1"># Examples to clarify shapes of the inputs and output</span>
<span class="c1"># x: [B, ..., M, K], y: [B, ..., K, N]</span>
<span class="n">fluid</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="c1"># out: [B, ..., M, N]</span>
<span class="c1"># x: [B, M, K], y: [B, K, N]</span> <span class="c1"># x: [B, M, K], y: [B, K, N]</span>
<span class="n">fluid</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="c1"># out: [B, M, N]</span> <span class="n">fluid</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="c1"># out: [B, M, N]</span>
<span class="c1"># x: [B, M, K], y: [K, N]</span> <span class="c1"># x: [B, M, K], y: [K, N]</span>
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册