Creates a `Dataset` from another `Dataset`, discarding duplicates. Use this transformation to produce a dataset that contains one instance of each unique element in the input. For example: ```python dataset = tf.data.Dataset.from_tensor_slices([1, 37, 2, 37, 2, 1]) # Using `unique()` wi
()
| 23 | |
| 24 | @deprecation.deprecated(None, "Use `tf.data.experimental.unique()`.") |
| 25 | def unique(): |
| 26 | """Creates a `Dataset` from another `Dataset`, discarding duplicates. |
| 27 | |
| 28 | Use this transformation to produce a dataset that contains one instance of |
| 29 | each unique element in the input. For example: |
| 30 | |
| 31 | ```python |
| 32 | dataset = tf.data.Dataset.from_tensor_slices([1, 37, 2, 37, 2, 1]) |
| 33 | |
| 34 | # Using `unique()` will drop the duplicate elements. |
| 35 | dataset = dataset.apply(tf.data.experimental.unique()) # ==> { 1, 37, 2 } |
| 36 | ``` |
| 37 | |
| 38 | Returns: |
| 39 | A `Dataset` transformation function, which can be passed to |
| 40 | `tf.data.Dataset.apply`. |
| 41 | """ |
| 42 | return experimental_unique.unique() |
no outgoing calls
no test coverage detected