mindspore.mint.eq

View Source On Gitee
mindspore.mint.eq(input, other)[source]

Compute the equivalence of the two inputs element-wise.

outi={True, if inputi=otheriFalse, if inputiotheri

Note

  • Support implicit type conversion.

  • The input must be two Tensors, or a Tensor and a Scalar.

  • The shapes of the inputs can be broadcasted to each other.

Parameters
  • input (Union[Tensor, Number]) – The first input.

  • other (Union[Tensor, Number]) – The second input.

Returns

Tensor

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> # case 1: The shape of two inputs are different
>>> x = mindspore.tensor([1, 2, 3], mindspore.float32)
>>> output = mindspore.mint.eq(x, 2.0)
>>> print(output)
[False  True False]
>>> # case 2: The shape of two inputs are the same
>>> x = mindspore.tensor([1, 2, 3], mindspore.int32)
>>> y = mindspore.tensor([1, 2, 4], mindspore.int32)
>>> output = mindspore.mint.eq(x, y)
>>> print(output)
[ True  True False]