# tf.math.subtract

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 2 version](https://www.tensorflow.org/api_docs/python/tf/math/subtract) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/math_ops.py#L349-L352) |

Returns x - y element-wise.

#### View aliases


**Main aliases**

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

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

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

<br />

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

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

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | A `Tensor`. Must be one of the following types: `bfloat16`, `half`, `float32`, `float64`, `uint8`, `int8`, `uint16`, `int16`, `int32`, `int64`, `complex64`, `complex128`. |
| `y` | A `Tensor`. Must have the same type as `x`. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `Tensor`. Has the same type as `x`. ||

<br />