less_than

paddle.fluid.layers.control_flow. less_than ( x, y, force_cpu=None, cond=None, name=None ) [source]

It operates element-wise on X and Y, and returns the Out. Each of them is a N-dim tensor. X and Y could be any type. The each element of the Out tensor is calculated by $Out = X < Y$

Parameters
  • x (Tensor) – the left hand operand of less_than operator.

  • y (Tensor) – the right hand operand of less_than operator.

  • force_cpu (BOOLEAN) – Force fill output variable to cpu memory. Otherwise, fill output variable to the running device [default true].

  • cond (Tensor, optional) – Optional output which can be any created Tensor that meets the requirements to store the result of less_than. if cond is None, a new Tensor will be created to store the result.

  • name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.

Returns

n-dim bool tensor. Each element is Out = X < Y.

Examples

import paddle

x = paddle.to_tensor([1, 2, 3, 4], dtype='float32')
y = paddle.to_tensor([2, 2, 1, 3], dtype='float32')
result = paddle.less_than(x, y)
print(result) # [True, False, False, False]