Have a question? Connect with the community at the TensorFlow Forum

# tf.math.equal

Returns the truth value of (x == y) element-wise.

### Used in the notebooks

Performs a broadcast with the arguments and then an element-wise equality comparison, returning a Tensor of boolean values.

#### For example:

````x = tf.constant([2, 4])`
`y = tf.constant(2)`
`tf.math.equal(x, y)`
`<tf.Tensor: shape=(2,), dtype=bool, numpy=array([ True,  False])>`
```
````x = tf.constant([2, 4])`
`y = tf.constant([2, 4])`
`tf.math.equal(x, y)`
`<tf.Tensor: shape=(2,), dtype=bool, numpy=array([ True,  True])>`
```

`x` A `tf.Tensor` or `tf.sparse.SparseTensor` or `tf.IndexedSlices`.
`y` A `tf.Tensor` or `tf.sparse.SparseTensor` or `tf.IndexedSlices`.
`name` A name for the operation (optional).

A `tf.Tensor` of type bool with the same size as that of x or y.

`tf.errors.InvalidArgumentError`: If shapes of arguments are incompatible

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"没有我需要的信息" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"太复杂/步骤太多" },{ "type": "thumb-down", "id": "outOfDate", "label":"内容需要更新" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"其他" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"易于理解" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"解决了我的问题" },{ "type": "thumb-up", "id": "otherUp", "label":"其他" }]