# tf.math.truediv

<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#L1618-L1649) |

Divides x / y elementwise (using Python 3 division operator semantics).

#### View aliases


**Main aliases**

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

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

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

<br />

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

> [!NOTE]
> **Note:** Prefer using the Tensor operator or tf.divide which obey Python division operator semantics.

This function forces Python 3 division operator semantics where all integer
arguments are cast to floating types first. This op is generated by normal
`x / y` division in Python 3 and in Python 2.7 with
`from __future__ import division`. If you want integer division that rounds
down, use `x // y` or `tf.math.floordiv`.

`x` and `y` must have the same numeric type. If the inputs are floating
point, the output will have the same type. If the inputs are integral, the
inputs are cast to `float32` for `int8` and `int16` and `float64` for `int32`
and `int64` (matching the behavior of Numpy).

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | `Tensor` numerator of numeric type. |
| `y` | `Tensor` denominator of numeric type. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| `x / y` evaluated in floating point. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `TypeError` | If `x` and `y` have different dtypes. |

<br />