解决module ‘tensorflow‘ has no attribute ‘…‘系列

人工智能57

在tensflow调试过程中遇到的报错问题,整理了一下,可能不全,参考其他博文成功解决的方法。

都是由于tensflow版本问题的差别。

原代码:

import tensorflow as tf
tf.reset_default_graph()

更改为:

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

原代码:

import tensorflow as tf
with tf.Session(graph=detection_graph) as sess:

更改为:

import tensorflow as tf
with tf.compat.v1.Session(graph=detection_graph) as sess:

od_graph_def = tf.compat.v1.GraphDef()
原代码:

import tensorflow as tf
od_graph_def = tf.GraphDef()

更改为:

import tensorflow as tf
od_graph_def = tf.compat.v1.GraphDef()

Original: https://blog.csdn.net/qq_45699150/article/details/120958872
Author: 张张张张张高高
Title: 解决module ‘tensorflow‘ has no attribute ‘...‘系列