dataset_unique: A transformation that discards duplicate elements of a...

Description Usage Arguments Value Note Examples

View source: R/dataset_methods.R

Description

Use this transformation to produce a dataset that contains one instance of each unique element in the input (See example).

Usage

1
dataset_unique(dataset, name = NULL)

Arguments

dataset

A tf.Dataset.

name

(Optional.) A name for the tf.data operation.

Value

A tf.Dataset

Note

This transformation only supports datasets which fit into memory and have elements of either tf.int32, tf.int64 or tf.string type.

Examples

1
2
3
4
5
6
7
8
## Not run: 
c(0, 37, 2, 37, 2, 1) %>% as_tensor("int32") %>%
  tensor_slices_dataset() %>%
  dataset_unique() %>%
  as_array_iterator() %>% iterate() %>% sort()
# [1]  0  1  2 37

## End(Not run)

tfdatasets documentation built on Nov. 10, 2021, 1:07 a.m.