- paddle. equal ( x, y, name=None )
This layer returns the truth value of \(x == y\) elementwise.
NOTICE: The output of this OP has no gradient.
x (Tensor) – Tensor, data type is bool, float32, float64, int32, int64.
y (Tensor) – Tensor, data type is bool, float32, float64, int32, int64.
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.
output Tensor, it’s shape is the same as the input’s Tensor, and the data type is bool. The result of this op is stop_gradient.
- Return type
import paddle x = paddle.to_tensor([1, 2, 3]) y = paddle.to_tensor([1, 3, 2]) result1 = paddle.equal(x, y) print(result1) # result1 = [True False False]