- paddle.fluid.layers.control_flow. less_equal ( x, y, cond=None, name=None )
paddle.less_equal :alias: paddle.less_equal,paddle.tensor.less_equal,paddle.tensor.logic.less_equal :old_api: paddle.fluid.layers.less_equal
This OP returns the truth value of \(x <= y\) elementwise, which is equivalent function to the overloaded operator <=.
x (Variable) – First input to compare which is N-D tensor. The input data type should be float32, float64, int32, int64.
y (Variable) – Second input to compare which is N-D tensor. The input data type should be float32, float64, int32, int64.
cond (Variable, optional) – Optional output which can be any created Variable that meets the requirements to store the result of less_equal. if cond is None, a new Varibale 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.
The tensor variable storing the output, the output shape is same as input
- Return type
Variable, the output data type is bool
import paddle.fluid as fluid import numpy as np label = fluid.layers.assign(np.array([1, 3], dtype='int32')) limit = fluid.layers.assign(np.array([1, 2], dtype='int32')) out = fluid.layers.less_equal(x=label, y=limit) #out=[True, False] out1 = label<= limit #out1=[True, False]