tensorflow2.0解决AttributeError: module ‘tensorflow‘ has no attribute ‘GraphDef‘

tensorflow2.0解决AttributeError: module ‘tensorflow’ has no attribute ‘GraphDef’

代码

graph_def = tf.GraphDef()

报错信息

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

解决办法

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

tensorflow2.0不兼容tensorflow1.0

你可能感兴趣的:(日常报错,tensorflow,深度学习,python,bug)