elementwise_equal

paddle.fluid.layers.elementwise_equal(x, y, name=None)[source]

This layer returns the truth value of \(x == y\) elementwise.

Parameters
  • x (Variable) – Tensor, data type is float32, float64, int32, int64.

  • y (Variable) – Tensor, data type is 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.

Returns

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

Variable

Examples

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