tfr.keras.strategy_utils.get_strategy
Creates and initializes the requested tf.distribute strategy.
tfr.keras.strategy_utils.get_strategy(
strategy: str,
cluster_resolver: Optional[tf.distribute.cluster_resolver.ClusterResolver] = None,
variable_partitioner: Optional[tf.distribute.experimental.partitioners.Partitioner] = _USE_DEFAULT_VARIABLE_PARTITIONER,
tpu: Optional[str] = ''
) -> Union[None, tf.distribute.MirroredStrategy, tf.distribute.
MultiWorkerMirroredStrategy, tf.distribute.experimental.
ParameterServerStrategy, tf.distribute.experimental.TPUStrategy]
Example usage:
strategy = get_strategy("MirroredStrategy")
Returns |
A strategy will be used for distributed training.
|
Raises |
ValueError if strategy is not supported.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-08-18 UTC.
[null,null,["Last updated 2023-08-18 UTC."],[],[]]