# tf.math.divide_no_nan

<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/divide_no_nan) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/math_ops.py#L1098-L1116) |

Computes a safe divide which returns 0 if the y is zero.

#### View aliases


**Compat aliases for migration**

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

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

<br />

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

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | A `Tensor`. Must be one of the following types: `float32`, `float64`. |
| `y` | A `Tensor` whose dtype is compatible with `x`. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The element-wise value of the x divided by y. ||

<br />