# tf.compat.v1.div

<br />

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

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

    tf.compat.v1.div(
        x, y, name=None
    )

<br />

## Migrate to TF2

<br />

> [!CAUTION]
> **Caution:** This API was designed for TensorFlow v1. Continue reading for details on how to migrate from this API to a native TensorFlow v2 equivalent. See the [TensorFlow v1 to TensorFlow v2 migration guide](https://www.tensorflow.org/guide/migrate) for instructions on how to migrate the rest of your code.

This function is deprecated in TF2. Prefer using the Tensor division operator,
[`tf.divide`](https://www.tensorflow.org/versions/r2.14/api_docs/python/tf/math/divide), or [`tf.math.divide`](https://www.tensorflow.org/versions/r2.14/api_docs/python/tf/math/divide), which obey the Python 3 division operator
semantics.

<br />

<br />

## Description

> [!WARNING]
> **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Deprecated in favor of operator or tf.math.divide.

This function divides `x` and `y`, forcing Python 2 semantics. That is, if `x`
and `y` are both integers then the result will be an integer. This is in
contrast to Python 3, where division with `/` is always a float while division
with `//` is always an integer.

<br />

<br />

<br />

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

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| `x / y` returns the quotient of x and y. ||

<br />