mindspore/docs/api/api_python/ops/mindspore.ops.Einsum.rst

21 lines
1.1 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.Einsum
=====================
.. py:class:: mindspore.ops.Einsum(equation)
此算子使用爱因斯坦求和约定Einsum进行Tensor计算。支持对角线、约和、转置、矩阵乘、乘积、内积运算等。
输入必须是Tensor的tuple。当输入只有一个Tensor时可以输入(Tensor, )支持数据类型float16、float32、float64。
参数:
- **equation** (str) - 属性表示要执行的计算。该值只能使用letter([a-z][A-Z])、commas(,)、ellipsis(...)和arrow(->)。letter([a-z][A-Z])表示输入的Tensor的维度commas(,)表示Tensor维度之间的分隔符ellipsis(...)表示不关心的Tensor维度arrow(->)的左侧表示输入Tensor右侧表示所需的输出维度。
输入:
- **x** (Tuple) - 用于计算的输入TensorTensor的数据类型必须相同。
输出:
Tensorshape可以从方程中获得数据类型与输入Tensor相同。
异常:
- **TypeError** - 如果 `equation` 本身无效,或者 `equation` 与输入Tensor不匹配。