【发布时间】:2017-01-17 11:25:17
【问题描述】:
我想在 tensorflow 中有条件地更改变量范围。
例如,如果scope 是字符串或None:
if scope is None:
a = tf.get_Variable(....)
b = tf.get_Variable(....)
else:
with tf.variable_scope(scope):
a = tf.get_Variable(....)
b = tf.get_Variable(....)
但我不想将a= ...、b= ... 部分写成双写。我只希望if ... else ... 确定范围,然后从那里做其他所有事情。
关于如何做到这一点的任何想法?
【问题讨论】:
标签: python scope tensorflow