<spanclass="n">fluid</span><spanclass="o">.</span><spanclass="n">layers</span><spanclass="o">.</span><spanclass="n">matmul</span><spanclass="p">(</span><spanclass="n">x</span><spanclass="p">,</span><spanclass="n">y</span><spanclass="p">)</span><spanclass="c1"># out: [B, ..., M, N]</span>
<spanclass="c1"># x: [B, M, K], y: [B, K, N]</span>
<spanclass="c1"># x: [B, M, K], y: [B, K, N]</span>
<spanclass="n">fluid</span><spanclass="o">.</span><spanclass="n">layers</span><spanclass="o">.</span><spanclass="n">matmul</span><spanclass="p">(</span><spanclass="n">x</span><spanclass="p">,</span><spanclass="n">y</span><spanclass="p">)</span><spanclass="c1"># out: [B, M, N]</span>
<spanclass="n">fluid</span><spanclass="o">.</span><spanclass="n">layers</span><spanclass="o">.</span><spanclass="n">matmul</span><spanclass="p">(</span><spanclass="n">x</span><spanclass="p">,</span><spanclass="n">y</span><spanclass="p">)</span><spanclass="c1"># out: [B, M, N]</span>
"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",
<spanclass="n">fluid</span><spanclass="o">.</span><spanclass="n">layers</span><spanclass="o">.</span><spanclass="n">matmul</span><spanclass="p">(</span><spanclass="n">x</span><spanclass="p">,</span><spanclass="n">y</span><spanclass="p">)</span><spanclass="c1"># out: [B, ..., M, N]</span>
<spanclass="c1"># x: [B, M, K], y: [B, K, N]</span>
<spanclass="c1"># x: [B, M, K], y: [B, K, N]</span>
<spanclass="n">fluid</span><spanclass="o">.</span><spanclass="n">layers</span><spanclass="o">.</span><spanclass="n">matmul</span><spanclass="p">(</span><spanclass="n">x</span><spanclass="p">,</span><spanclass="n">y</span><spanclass="p">)</span><spanclass="c1"># out: [B, M, N]</span>
<spanclass="n">fluid</span><spanclass="o">.</span><spanclass="n">layers</span><spanclass="o">.</span><spanclass="n">matmul</span><spanclass="p">(</span><spanclass="n">x</span><spanclass="p">,</span><spanclass="n">y</span><spanclass="p">)</span><spanclass="c1"># out: [B, M, N]</span>