In TensorFlow 2, it is also possible to configure datasets by setting global options, which will affect all their operations. tf.data.Options is a structure that can be passed to datasets through their .with_options(options) method and that has several attributes to parametrize the datasets (refer to the documentation at https://www.tensorflow.org/api_docs/python/tf/data/Options).
For instance, if the .experimental_autotune Boolean attribute is set to True, TensorFlow will automatically tune the values of num_parallel_calls for all the dataset's operations, according to the capacity of the target machine(s).
The attribute currently named .experimental_optimization contains a set of sub-options related to the automatic optimization of the dataset's operations (refer to the previous information box). For example, its own .map_and_batch_fusion attribute can be set to True to let TensorFlow automatically fuse the .map() and .batch() calls...