tf.data.experimental.unique
View source on GitHub |
Creates a Dataset
from another Dataset
, discarding duplicates.
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 }
Returns | |
---|---|
A Dataset transformation function, which can be passed to tf.data.Dataset.apply . |
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/data/experimental/unique