You may be using tensorflow 2.0. If that is the case, to use TF-1 within TF-2, the import statement should be edited as below.
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior( )
AttributeError: module 'tensorflow' has no attribute 'GraphDef'/ 'Session'
Since the version of tf2 is under Ubuntu, it will be different from the previous version.
change tf.GraphDef()
-> tf.compat.v1.GraphDef()
change tf.Session()
-> tf.compat.v1.Session()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.