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