mindspore.ops.less
- mindspore.ops.less(input, other)[source]
Computes the boolean value of
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.
- Parameters
- 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
GPU
CPU
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, ops >>> input = Tensor(np.array([1, 2, 3]), mindspore.int32) >>> other = Tensor(np.array([1, 1, 4]), mindspore.int32) >>> output = ops.less(input, other) >>> print(output) [False False True]