Python 在tensorflow 2.0中获取变量范围

Python 在tensorflow 2.0中获取变量范围,python,tensorflow,variables,scope,Python,Tensorflow,Variables,Scope,我正在使用新版本的tensorflow(2.0.0 alpha),我不知道为什么它不允许我运行: tf.get_variable_scope().reuse_variables() 我得到以下错误: AttributeError: module 'tensorflow' has no attribute 'get_variable_scope' 我猜有一个新属性的名称不同?谢谢 来自评论 否,variable\u scope和get\u variable已从TensorFlow 2.x中删除

我正在使用新版本的tensorflow(2.0.0 alpha),我不知道为什么它不允许我运行:

tf.get_variable_scope().reuse_variables()
我得到以下错误:

AttributeError: module 'tensorflow' has no attribute 'get_variable_scope'
我猜有一个新属性的名称不同?谢谢

来自评论


否,
variable\u scope
get\u variable
已从
TensorFlow 2.x
中删除(尽管您仍然可以在下面找到它们)。在
tf2.x
中,要返回当前变量范围,可以使用
TF.compat.v1.get_variable_scope
而不是
get_variable_scope
。有关更多详细信息,请参阅。(摘自jdehesa)


否,
variable\u scope
get\u variable
已从TensorFlow 2.x中删除(尽管您仍然可以在下面找到它们)。参见RFC。