用法
variable_created_in_scope(
v
)
測試在此策略範圍處於活動狀態時是否創建了 v
。
在策略範圍內創建的變量是它的"owned":
strategy = tf.distribute.MirroredStrategy()
with strategy.scope():
v = tf.Variable(1.)
strategy.extended.variable_created_in_scope(v)
True
在策略之外創建的變量不屬於它:
strategy = tf.distribute.MirroredStrategy()
v = tf.Variable(1.)
strategy.extended.variable_created_in_scope(v)
False
相關用法
- Python tf.distribute.StrategyExtended.reduce_to用法及代碼示例
- Python tf.distribute.StrategyExtended.batch_reduce_to用法及代碼示例
- Python tf.distribute.StrategyExtended.update用法及代碼示例
- Python tf.distribute.StrategyExtended.colocate_vars_with用法及代碼示例
- Python tf.distribute.Strategy.scope用法及代碼示例
- Python tf.distribute.Strategy.experimental_distribute_values_from_function用法及代碼示例
- Python tf.distribute.Strategy用法及代碼示例
- Python tf.distribute.Strategy.reduce用法及代碼示例
- Python tf.distribute.Strategy.experimental_distribute_dataset用法及代碼示例
- Python tf.distribute.Strategy.run用法及代碼示例
- Python tf.distribute.Strategy.gather用法及代碼示例
- Python tf.distribute.Server用法及代碼示例
- Python tf.distribute.OneDeviceStrategy.experimental_distribute_values_from_function用法及代碼示例
- Python tf.distribute.TPUStrategy用法及代碼示例
- Python tf.distribute.experimental_set_strategy用法及代碼示例
- Python tf.distribute.experimental.MultiWorkerMirroredStrategy.gather用法及代碼示例
- Python tf.distribute.cluster_resolver.TFConfigClusterResolver用法及代碼示例
- Python tf.distribute.experimental.MultiWorkerMirroredStrategy用法及代碼示例
- Python tf.distribute.TPUStrategy.experimental_assign_to_logical_device用法及代碼示例
- Python tf.distribute.NcclAllReduce用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.distribute.StrategyExtended.variable_created_in_scope。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。