Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 375
user11400799 Avatar asked Jan 17 '26 23:01

user11400799


1 Answers

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).

like image 134
user11530462 Avatar answered Jan 19 '26 14:01

user11530462



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!