mindspore.mint.less_equal

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

Compute the value of input<=other element-wise.

outi={True, if inputi<=otheriFalse, if inputi>otheri

Note

  • Support implicit type conversion.

  • When the inputs are one tensor and one scalar, the scalar could only be a constant.

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

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

Returns

Tensor

Supported Platforms:

Ascend

Examples

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