user11400799
user11400799

Reputation: 143

Get variable scope in tensorflow 2.0

I am using the new version of tensorflow (2.0.0 alpha) and I dont know why it does not allow me to run:

tf.get_variable_scope().reuse_variables()

I am getting the following error:

AttributeError: module 'tensorflow' has no attribute 'get_variable_scope'

I guess there is a new attribute with a different name? Thanks!

Upvotes: 3

Views: 6703

Answers (1)

user11530462
user11530462

Reputation:

From comments

No, variable_scope and get_variable have been removed from TensorFlow 2.x (although you can still find them under tf.compat.v1). In TF 2.x to returns the current variable scope you can use tf.compat.v1.get_variable_scope instead of get_variable_scope. For more details please refer Migrate from TF1 to TF2. (paraphrased from jdehesa).

Upvotes: 1

Related Questions