You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.ops.BatchMatMul.rst 1.4 kB

123456789101112131415161718192021222324252627282930
  1. mindspore.ops.BatchMatMul
  2. =========================
  3. .. py:class:: mindspore.ops.BatchMatMul(transpose_a=False, transpose_b=False)
  4. 两个batch后的Tensor之间的矩阵乘法。
  5. .. math::
  6. \text{output}[..., :, :] = \text{matrix}(x[..., :, :]) * \text{matrix}(y[..., :, :])
  7. 两个输入Tensor必须具有相同的秩,并且秩必须不小于 `3`。
  8. **参数:**
  9. - **transpose_a** (bool) - 如果为True,则在乘法之前转置 `x` 的最后两个维度。默认值:False。
  10. - **transpose_b** (bool) - 如果为True,则在乘法之前转置 `y` 的最后两个维度。默认值:False。
  11. **输入:**
  12. - **x** (Tensor):输入相乘的第一个Tensor。其shape为 :math:`(*B, N, C)` ,其中 :math:`*B` 表示批处理大小,可以是多维度, :math:`N` 和 :math:`C` 是最后两个维度的大小。如果 `transpose_a` 为True,则其shape必须为 :math:`(*B,C,N)` 。
  13. - **y** (Tensor):输入相乘的第二个Tensor。Tensor的shape为 :math:`(*B, C, M)` 。如果 `transpose_b` 为True,则其shape必须为 :math:`(*B, M, C)` 。
  14. **输出:**
  15. Tensor,输出Tensor的shape为 :math:`(*B, N, M)` 。
  16. **异常:**
  17. - **TypeError** - `transpose_a` 或 `transpose_b` 不是bool。
  18. - **ValueError** - `x` 的shape长度不等于 `y` 的shape长度或 `x` 的shape长度小于3。