TensorFlow

API

 tf.distribute / get_replica_context


Return if there is a current non-default tf.distribute.Strategy.

assert not tf.distribute.has_strategy()
with strategy.scope():
  assert tf.distribute.has_strategy()

True if inside a with strategy.scope():.

此页内容是否对您有帮助