mindspore2022/docs/api/api_python/ops/mindspore.ops.Equal.rst

32 lines
1.1 KiB
ReStructuredText
Raw 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.Equal
====================
.. py:class:: mindspore.ops.Equal
逐元素比较两个输入Tensor是否相等。
.. math::
out_{i} =\begin{cases}
& \text{True, if } x_{i} = y_{i} \\
& \text{False, if } x_{i} \ne y_{i}
\end{cases}
.. note::
- 输入 `x``y` 遵循隐式类型转换规则,使数据类型保持一致。
- 输入必须是两个Tensor或一个Tensor和一个Scalar。
- 当输入是两个Tensor时它们的shape可以广播。
- 当输入是一个Tensor和一个Scalar时Scalar只能是一个常数。
- 支持广播。
**输入:**
- **x** (Union[Tensor, Number]) - 第一个输入可以是数值型也可以是数据类型为数值型的Tensor。
- **y** (Union[Tensor, Number]) - 当第一个输入是Tensor时第二个输入是数值型或数据类型为数值型的Tensor。数据类型与第一个输入相同。
**输出:**
Tensor输出的shape与输入广播后的shape相同数据类型为bool。
**异常:**
- **TypeError** - `x``y` 都不是Tensor。