TF 2.0 is out! Get hands-on practice at TF World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

tf.contrib.data.unique

View source on GitHub

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

tf.contrib.data.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 }

Returns:

A Dataset transformation function, which can be passed to tf.data.Dataset.apply.