lynn
lynn

Reputation: 143

How to use tf.data.Options()?

Is one dataset created accompanied by default options? If not, how to use the tf.data.Options()? Just dataset = dataset.with_options(options)? Is there anything else to be noticed?

Upvotes: 4

Views: 1741

Answers (1)

Daniel Braun
Daniel Braun

Reputation: 2722

First create a tf.data.options instance. Then set the properties as you wish. For example:

dataset = tf.data.Dataset.range(10000)

options = tf.data.Options()
options.experimental_optimization.apply_default_optimizations = True
options.experimental_threading.private_threadpool_size = 10

dataset = dataset.with_options(options)

For all options available to you

Upvotes: 4

Related Questions