# tf.math.not_equal

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/ops/math_ops.py#L2006-L2040) |

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

#### View aliases


**Main aliases**

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

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

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

<br />

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

Performs a [broadcast](https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) with the
arguments and then an element-wise inequality comparison, returning a Tensor
of boolean values.

#### For example:

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

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

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | A [`tf.Tensor`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/Tensor). |
| `y` | A [`tf.Tensor`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/Tensor). |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A [`tf.Tensor`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/Tensor) of type bool with the same size as that of x or y. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| [`tf.errors.InvalidArgumentError`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/errors/InvalidArgumentError): If shapes of arguments are incompatible ||

<br />