使用云平台或者别的服务器时,如果安装的是高版本的tf(tf2.x),跑比较旧的代码容易出现这种报错。解决方案:注释tf的引用,换为兼容模式。
# import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
使用云平台或者别的服务器时,如果安装的是高版本的tf(tf2.x),跑比较旧的代码容易出现这种报错。解决方案:注释tf的引用,换为兼容模式。
# import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()