Hvass-Labs / TensorFlow-Tutorials

TensorFlow Tutorials with YouTube Videos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

module 'tensorflow.python.ops.variable_scope' has no attribute '_VARSCOPE_KEY'

haideralimughal opened this issue · comments

Could you please give me any suggestions why i am getting this error in Prettytensor tutorials

WARNING:tensorflow:From C:/Users/Administrator/PycharmProjects/Tensorflow/Simple_Linear_Model.py:75: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

WARNING:tensorflow:From C:/Users/Administrator/PycharmProjects/Tensorflow/Simple_Linear_Model.py:81: calling argmax (from tensorflow.python.ops.math_ops) with dimension is deprecated and will be removed in a future version.
Instructions for updating:
Use the axis argument instead
WARNING:tensorflow:From C:\Users\Administrator\anaconda3\envs\test\lib\site-packages\prettytensor\bookkeeper.py:80: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.

WARNING:tensorflow:From C:\Users\Administrator\anaconda3\envs\test\lib\site-packages\prettytensor\scopes.py:47: The name tf.get_variable_scope is deprecated. Please use tf.compat.v1.get_variable_scope instead.

WARNING:tensorflow:From C:\Users\Administrator\anaconda3\envs\test\lib\site-packages\prettytensor\scopes.py:55: The name tf.get_collection_ref is deprecated. Please use tf.compat.v1.get_collection_ref instead.

Traceback (most recent call last):
File "C:/Users/Administrator/PycharmProjects/Tensorflow/Simple_Linear_Model.py", line 238, in
conv2d(kernel=5, depth=16, name='layer_conv1').
File "C:\Users\Administrator\anaconda3\envs\test\lib\site-packages\prettytensor\pretty_tensor_class.py", line 1965, in method
with _method_scope(input_layer, scope_name) as (scope, _):
File "C:\Users\Administrator\anaconda3\envs\test\lib\contextlib.py", line 112, in enter
return next(self.gen)
File "C:\Users\Administrator\anaconda3\envs\test\lib\site-packages\prettytensor\pretty_tensor_class.py", line 1776, in _method_scope
scopes.var_and_name_scope((name, None)) as (scope, var_scope):
File "C:\Users\Administrator\anaconda3\envs\test\lib\contextlib.py", line 112, in enter
return next(self.gen)
File "C:\Users\Administrator\anaconda3\envs\test\lib\site-packages\prettytensor\scopes.py", line 55, in var_and_name_scope
vs_key = tf.get_collection_ref(variable_scope._VARSCOPE_KEY)
AttributeError: module 'tensorflow.python.ops.variable_scope' has no attribute '_VARSCOPE_KEY'

Process finished with exit code 1

You haven't even written which version of TensorFlow you are using so it's very hard to help you. But it looks like you are trying to use very old TensorFlow code with a new version of TensorFlow. As written in the README for these tutorials, several tutorials are no longer supported in TensorFlow 2. If you want to run them, you need to either use an old version of TensorFlow, or you could try and run TF2 in v.1 compatibility mode. But I cannot help you with either. You need to google for instructions on how to do that. If you do find the solution then please write it here so it may help others in the future.

Also, I would suggest you learn how to use Keras instead of PrettyTensor.