# megengine.functional.greater¶

greater(x, y)[源代码]

Element-wise greater-than comparison.

Computes the truth value of $$x_i > y_i$$ for each element $$x_i$$ of the input tensor $$x$$ with the respective element $$y_i$$ of the input tensor $$y$$.

• x – first input tensor. May have any data type.

• y – second input tensor. Must be compatible with $$x$$ (see 广播机制与规则 ). May have any data type.

a tensor containing the result of the element-wise results.

Element-wise greater-than comparison:

>>> x = Tensor([1, 2, 3])
>>> y = Tensor([1, 2, 4])
>>> F.greater(x, y)
Tensor([False False False], dtype=bool, device=xpux:0)


The > operator can be used as a shorthand for F.greater on boolean tensors.

>>> x > y
Tensor([False False False], dtype=bool, device=xpux:0)