tf.distribute.in_cross_replica_context
Возвращает True, если выполняется в контексте между репликами.
tf.distribute.in_cross_replica_context()
Подробную информацию см. в разделе tf.distribute.get_replica_context.
assert not tf.distribute.in_cross_replica_context()
with strategy.scope():
assert tf.distribute.in_cross_replica_context()
def f():
assert not tf.distribute.in_cross_replica_context()
strategy.run(f)
| Возвращаемое значение | |
|---|---|
True в контексте между репликами (get_replica_context() возвращает None) или False в контексте реплики (get_replica_context() возвращает значение, отличное от None). |
© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/distribute/in_cross_replica_context