# tf.contrib.data.unique

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/data/python/ops/unique.py#L24-L42) |

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

    tf.contrib.data.unique()

> [!WARNING]
> **Warning:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use [`tf.data.experimental.unique()`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/data/experimental/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/r1.15/api_docs/python/tf/data/Dataset#apply). ||

<br />