mindspore.mint.less

mindspore.mint.less(input, other)[source]

Computes the boolean value of \(input < other\) element-wise.

The inputs of input and other follow implicit type conversion rules to ensure consistent data types. When the inputs are a Tensor and a Scalar, the Scalar can only be a constant.

\[\begin{split}out_{i} =\begin{cases} & \text{True, if } input_{i}<other_{i} \\ & \text{False, if } input_{i}>=other_{i} \end{cases}\end{split}\]
Parameters
  • input (Union[Tensor, Number, bool]) – The first input is a number or a bool or a tensor whose data type is number or bool.

  • other (Union[Tensor, Number, bool]) – The second input is a number or a bool or a tensor whose data type is number or bool.

Returns

Tensor, the shape is the same as the one after broadcasting,and the data type is bool.

Raises

TypeError – If input and other is not one of the following: Tensor, Number, bool.

Supported Platforms:

Ascend

Examples

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