mindspore.Tensor.less
- Tensor.less(other) Tensor
Computes the boolean value of \(self < other\) element-wise.
The inputs of self and other follow implicit type conversion rules to ensure consistent data types. When the other is Scalar, it can only be a constant.
\[\begin{split}out_{i} =\begin{cases} & \text{True, if } self_{i}<other_{i} \\ & \text{False, if } self_{i}>=other_{i} \end{cases}\end{split}\]- Parameters
other (Union[Tensor, Number, bool]) – 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 self and other is not one of the following: Tensor, Number, bool.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> 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.less(other) >>> print(output) [False False True]