Use this transformation to produce a dataset that contains one instance of
each unique element in the input. For example:
dataset=tf.data.Dataset.from_tensor_slices([1,37,2,37,2,1])# Using `unique()` will drop the duplicate elements.dataset=dataset.apply(tf.data.experimental.unique())# ==> { 1, 37, 2 }
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf.data.experimental.unique\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/unique.py#L20-L43) |\n\nCreates a `Dataset` from another `Dataset`, discarding duplicates. (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.unique`](https://www.tensorflow.org/api_docs/python/tf/data/experimental/unique)\n\n\u003cbr /\u003e\n\n tf.data.experimental.unique()\n\n| **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use \\`tf.data.Dataset.unique(...)\n\nUse this transformation to produce a dataset that contains one instance of\neach unique element in the input. For example: \n\n dataset = tf.data.Dataset.from_tensor_slices([1, 37, 2, 37, 2, 1])\n\n # Using `unique()` will drop the duplicate elements.\n dataset = dataset.apply(tf.data.experimental.unique()) # ==\u003e { 1, 37, 2 }\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"]]