mindspore.Tensor.eq

查看源文件
Tensor.eq(other)

详情请参考 mindspore.ops.eq()

支持平台:

Ascend GPU CPU

样例:

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