# tf.math.equal

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 1 version](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/math/equal) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/python/ops/math_ops.py#L1278-L1306) |

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

#### View aliases


**Main aliases**

[`tf.equal`](https://www.tensorflow.org/api_docs/python/tf/math/equal)
**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.equal`](https://www.tensorflow.org/api_docs/python/tf/math/equal), [`tf.compat.v1.math.equal`](https://www.tensorflow.org/api_docs/python/tf/math/equal)

<br />

    tf.math.equal(
        x, y, name=None
    )

#### Usage:

    x = tf.constant([2, 4])
    y = tf.constant(2)
    tf.math.equal(x, y) ==> array([True, False])

    x = tf.constant([2, 4])
    y = tf.constant([2, 4])
    tf.math.equal(x, y) ==> array([True,  True])

> [!NOTE]
> **Note:** `Equal` supports broadcasting. More about broadcasting [here](https://docs.scipy.org/doc/numpy-1.13.0/user/basics.broadcasting.html)

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | A `Tensor` or `SparseTensor` or `IndexedSlices`. |
| `y` | A `Tensor` or `SparseTensor` or `IndexedSlices`. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `Tensor` of type bool with the same size as that of x or y. ||

<br />