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 anInvalidArgumentError.dataset=dataset.map(lambdax: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'.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf.data.experimental.ignore_errors\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/data/experimental/ops/error_ops.py#L20-L51) |\n\nCreates a `Dataset` from another `Dataset` and silently ignores any errors. (deprecated)\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.data.experimental.ignore_errors`](https://www.tensorflow.org/api_docs/python/tf/data/experimental/ignore_errors)\n\n\u003cbr /\u003e\n\n tf.data.experimental.ignore_errors(\n log_warning=False\n )\n\n### Used in the notebooks\n\n| Used in the tutorials |\n|--------------------------------------------------------------------------------------------------------|\n| - [Image captioning with visual attention](https://www.tensorflow.org/text/tutorials/image_captioning) |\n\n| **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use [`tf.data.Dataset.ignore_errors`](../../../tf/data/Dataset#ignore_errors) instead.\n\nUse this transformation to produce a dataset that contains the same elements\nas the input, but silently drops any elements that caused an error. For\nexample: \n\n dataset = tf.data.Dataset.from_tensor_slices([1., 2., 0., 4.])\n\n # Computing `tf.debugging.check_numerics(1. / 0.)` will raise an\n InvalidArgumentError.\n dataset = dataset.map(lambda x: tf.debugging.check_numerics(1. / x, \"error\"))\n\n # Using `ignore_errors()` will drop the element that causes an error.\n dataset =\n dataset.apply(tf.data.experimental.ignore_errors()) # ==\u003e {1., 0.5, 0.2}\n\nArgs:\nlog_warning: (Optional.) A 'tf.bool' scalar indicating whether ignored\nerrors should be logged to stderr. Defaults to 'False'.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Dataset` transformation function, which can be passed to [`tf.data.Dataset.apply`](../../../tf/data/Dataset#apply). ||\n\n\u003cbr /\u003e"]]