mindspore.Tensor.greater_equal

查看源文件
mindspore.Tensor.greater_equal(other)

逐元素计算 \(self >= other\) 的bool值。

\[\begin{split}out_{i} =\begin{cases} & \text{True, if } self_{i}>=other_{i} \\ & \text{False, if } self_{i}<other_{i} \end{cases}\end{split}\]
参数:
  • other (Union[Tensor, Number]) - other 应该是一个Number或数据类型为number或bool的Tensor。

返回:

Tensor,shape与广播后的shape相同,数据类型为bool。

支持平台:

Ascend GPU CPU

样例:

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor
>>> input = Tensor(np.array([1, 2, 3]), mindspore.int32)
>>> other = Tensor(np.array([1, 1, 4]), mindspore.int32)
>>> output = input.greater_equal(other)
>>> print(output)
[True True False]
>>> other = 2.1
>>> output = input.greater_equal(other)
>>> print(output)
[False False True]