# tf.data.experimental.unique

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/data/experimental/ops/unique.py#L20-L43) |

Creates a `Dataset` from another `Dataset`, discarding duplicates. (deprecated)

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.data.experimental.unique()

> [!WARNING]
> **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use \`tf.data.Dataset.unique(...)

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 }

<br />

<br />

<br />

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

<br />