greater_than

paddle.fluid.layers.greater_than(x, y, cond=None)[source]

This OP returns the truth value of \(x > y\) elementwise, which is equivalent function to the overloaded operator >.

Parameters
  • 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) – If is None, the op will create a variable as output tensor, the shape and data type of this tensor is the same as input x . If is not None, the op will set the variable as output tensor, the shape and data type of this tensor should be the same as input x . Default value is None.

Returns

The tensor variable storing the output, the output shape is the same as input x .

Return type

Variable, the output data type is bool.

Examples

import paddle.fluid as fluid
import numpy as np
label = fluid.layers.assign(np.array([2, 3], dtype='int32'))
limit = fluid.layers.assign(np.array([3, 2], dtype='int32'))
out = fluid.layers.greater_than(x=label, y=limit) #out=[False, True]
out1 = label > limit #out1=[False, True]