當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python tf.distribute.has_strategy用法及代碼示例

如果當前存在非默認 tf.distribute.Strategy ,則返回。

用法

tf.distribute.has_strategy()

返回

  • 如果在 with strategy.scope(): 內,則為真。
assert not tf.distribute.has_strategy()
with strategy.scope():
  assert tf.distribute.has_strategy()

相關用法


注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.distribute.has_strategy。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。