tf.distribute.in_cross_replica_context
| Просмотреть исходный код на GitHub |
Возвращает 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). |
© 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/in_cross_replica_context