# tf.data.experimental.ignore_errors

<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/data/experimental/ops/error_ops.py#L20-L51) |

Creates a `Dataset` from another `Dataset` and silently ignores any errors. (deprecated)

#### View aliases


**Compat aliases for migration**

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

[`tf.compat.v1.data.experimental.ignore_errors`](https://www.tensorflow.org/api_docs/python/tf/data/experimental/ignore_errors)

<br />

    tf.data.experimental.ignore_errors(
        log_warning=False
    )

> [!WARNING]
> **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use [`tf.data.Dataset.ignore_errors`](https://www.tensorflow.org/versions/r2.14/api_docs/python/tf/data/Dataset#ignore_errors) instead.

Use this transformation to produce a dataset that contains the same elements
as the input, but silently drops any elements that caused an error. For
example:

    dataset = tf.data.Dataset.from_tensor_slices([1., 2., 0., 4.])

    # Computing `tf.debugging.check_numerics(1. / 0.)` will raise an
    InvalidArgumentError.
    dataset = dataset.map(lambda x: tf.debugging.check_numerics(1. / x, "error"))

    # Using `ignore_errors()` will drop the element that causes an error.
    dataset =
        dataset.apply(tf.data.experimental.ignore_errors())  # ==> {1., 0.5, 0.2}

Args:
log_warning: (Optional.) A 'tf.bool' scalar indicating whether ignored
errors should be logged to stderr. Defaults to 'False'.

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `Dataset` transformation function, which can be passed to [`tf.data.Dataset.apply`](https://www.tensorflow.org/versions/r2.14/api_docs/python/tf/data/Dataset#apply). ||

<br />