Reputation: 41
In attempting to run the following in PyCharm 2017.3.1:
with open('../data/UrbanSound8K/retrained_graph.pb', 'rb') as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
tf.import_graph_def(graph_def, name='')
I receive the following:
/anaconda/bin/python3 /Users/PycharmProjects/UrbanSound/src/recognize_sound.py
Traceback (most recent call last):
File "/Users/PycharmProjects/UrbanSound/src/recognize_sound.py", line 12, in <module>
graph_def = tf.GraphDef()
AttributeError: module 'tensorflow' has no attribute 'GraphDef'
Here is some environment information:
(tensorflow) $ python3 -c 'import tensorflow as tf; print(tf.__version__)'
1.4.0
(tensorflow) $ python -V
Python 3.6.2
Thank you in advance for your help.
Upvotes: 4
Views: 13330
Reputation: 31
disable V2 behavior
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
or use this tf.compat.v1.GraphDef()
Upvotes: 1
Reputation: 41
I resolved it using
python36 -m pip install tensorflow-gpu==1.14
Upvotes: 1