W3cubDocs

/TensorFlow 2.3

tf.distribute.get_strategy

View source on GitHub

Returns the current tf.distribute.Strategy object.

Typically only used in a cross-replica context:

if tf.distribute.in_cross_replica_context():
  strategy = tf.distribute.get_strategy()
  ...
Returns
A tf.distribute.Strategy object. Inside a with strategy.scope() block, it returns strategy, otherwise it returns the default (single-replica) tf.distribute.Strategy object.

© 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/distribute/get_strategy