TensorFlow

API

 tf.distribute / experimental_set_strategy


Returns the current tf.distribute.Strategy object.

Used in the notebooks

Used in the guide

Typically only used in a cross-replica context:

if tf.distribute.in_cross_replica_context():
  strategy = tf.distribute.get_strategy()
  ...

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.

此页内容是否对您有帮助