我正在使用新版本的tensorflow (2.0.0 alpha),但我不知道为什么它不允许我运行:
tf.get_variable_scope().reuse_variables()
我遇到了以下错误:
AttributeError: module 'tensorflow' has no attribute 'get_variable_scope'
我猜可能有一个不同名称的新属性?谢谢!
我正在使用新版本的tensorflow (2.0.0 alpha),但我不知道为什么它不允许我运行:
tf.get_variable_scope().reuse_variables()
我遇到了以下错误:
AttributeError: module 'tensorflow' has no attribute 'get_variable_scope'
我猜可能有一个不同名称的新属性?谢谢!
来自评论
不,
variable_scope
和get_variable
已经从TensorFlow 2.x
中删除(尽管你仍然可以在tf.compat.v1中找到它们)。在TF 2.x
中返回当前变量作用域,您可以使用tf.compat.v1.get_variable_scope
代替get_variable_scope
。有关更多详细信息,请参见从TF1迁移到TF2。(由jdehesa改写)。
variable_scope
和get_variable
已经从TensorFlow 2.x中删除(尽管您仍然可以在tf.compat.v1
下找到它们)。请参阅RFC Variables in TensorFlow 2.0。 - jdehesa