<分区> 分区>
有没有办法取消设置变量范围内的重用? 我尝试了以下命令:
In [1]: import tensorflow as tf
In [2]: tf.get_variable_scope().reuse
Out[2]: False
In [3]: tf.get_variable_scope().reuse_variables
Out[3]: <bound method VariableScope.reuse_variables of <tensorflow.python.ops.variable_scope.VariableScope object at 0x7fd9cc46c4d0>>
In [4]: tf.get_variable_scope().reuse_variables()
In [5]: tf.get_variable_scope().reuse
Out[5]: True
In [6]: tf.get_variable_scope().reuse_variables()
In [7]: tf.get_variable_scope().reuse
Out[7]: True
In [8]: tf.get_variable_scope().reuse_variables(False)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-8-ba19ed12625c> in <module>()
----> 1 tf.get_variable_scope().reuse_variables(False)
TypeError: reuse_variables() takes exactly 1 argument (2 given)
In [9]: tf.get_variable_scope().reuse = False
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-9-ddd0b37e4f0e> in <module>()
----> 1 tf.get_variable_scope().reuse = False
AttributeError: can't set attribute
In [10]: tf.get_variable_scope().reuse_variables = False
In [11]: tf.get_variable_scope().reuse_variables()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-11-d03dc0fb25b6> in <module>()
----> 1 tf.get_variable_scope().reuse_variables()
TypeError: 'bool' object is not callable
如您所见,我无法通过多次调用 reuse_variables 来取消设置 reuse,我无法使用 = 设置它> 运算符,出于某种原因我可以设置任何我想要的而不是 reuse_variables 函数(这是一个错误吗?)。
