until_out_of_range

0th

Percentile

Execute code that traverses a dataset until an out of range condition occurs

Execute code that traverses a dataset until an out of range condition occurs

Usage
until_out_of_range(expr)

out_of_range_handler(e)

Arguments
expr

Expression to execute (will be executed multiple times until the condition occurs)

e

Error object

Details

When a dataset iterator reaches the end, an out of range runtime error will occur. This function will catch and ignore the error when it occurs.

Aliases
  • until_out_of_range
  • out_of_range_handler
Examples
# NOT RUN {
library(tfdatasets)
dataset <- text_line_dataset("mtcars.csv", record_spec = mtcars_spec) %>%
  dataset_batch(128) %>%
  dataset_repeat(10) %>%
  dataset_prepare(x = c(mpg, disp), y = cyl)

iter <- make_iterator_one_shot(dataset)
next_batch <- iterator_get_next(iter)

until_out_of_range({
  batch <- sess$run(next_batch)
  # use batch$x and batch$y tensors
})
# }
# NOT RUN {
# }
Documentation reproduced from package tfdatasets, version 1.13.1, License: Apache License 2.0

Community examples

Looks like there are no examples yet.