View source on GitHub |
Represents options for distributed data processing.
tf.data.experimental.DistributeOptions()
You can set the distribution options of a dataset through the experimental_distribute
property of tf.data.Options
; the property is an instance of tf.data.experimental.DistributeOptions
.
options = tf.data.Options() options.experimental_distribute.auto_shard_policy = AutoShardPolicy.OFF dataset = dataset.with_options(options)
Attributes | |
---|---|
auto_shard_policy | The type of sharding that auto-shard should attempt. If this is set to FILE, then we will attempt to shard by files (each worker will get a set of files to process). If we cannot find a set of files to shard for at least one file per worker, we will error out. When this option is selected, make sure that you have enough files so that each worker gets at least one file. There will be a runtime error thrown if there are insufficient files. If this is set to DATA, then we will shard by elements produced by the dataset, and each worker will process the whole dataset and discard the portion that is not for itself. If this is set to OFF, then we will not autoshard, and each worker will receive a copy of the full dataset. This option is set to AUTO by default, AUTO will attempt to first shard by FILE, and fall back to sharding by DATA if we cannot find a set of files to shard. |
num_devices | The number of devices attached to this input pipeline. This will be automatically set by MultiDeviceIterator. |
__eq__
__eq__( other )
Return self==value.
__ne__
__ne__( other )
Return self!=value.
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/data/experimental/DistributeOptions