parquet_dataset: Create a 'ParquetDataset'.

Description Usage Arguments Examples

View source: R/parquet_dataset.R

Description

This allows a user to read data from a parquet file.

Usage

1
parquet_dataset(filenames, columns, output_types)

Arguments

filenames

A 0-D or 1-D tf.string tensor containing one or more filenames.

columns

A 0-D or 1-D tf.int32 tensor containing the columns to extract.

output_types

A tuple of tf.DType objects representing the types of the columns returned.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
dtypes <- tf$python$framework$dtypes
output_types <- reticulate::tuple(
  dtypes$bool, dtypes$int32, dtypes$int64, dtypes$float32, dtypes$float64)
dataset <- parquet_dataset(
    filenames = list("testdata/parquet_cpp_example.parquet"),
    columns = list(0, 1, 2, 4, 5),
    output_types = output_types) %>%
  dataset_repeat(2)

sess <- tf$Session()
iterator <- make_iterator_one_shot(dataset)
next_batch <- iterator_get_next(iterator)

until_out_of_range({
  batch <- sess$run(next_batch)
  print(batch)
})

## End(Not run)

tfio documentation built on Dec. 25, 2019, 5:06 p.m.