东方耀AI技术分享

标题: module 'tensorflow' has no attribute 'placeholder' tensorflow2.0提示错误 [打印本页]

作者: 东方耀    时间: 2021-5-10 09:07
标题: module 'tensorflow' has no attribute 'placeholder' tensorflow2.0提示错误




诸如此类报错:
module 'tensorflow' has no attribute 'logging'


module 'tensorflow_core._api.v2.random' has no attribute 'set_random_seed'




module 'tensorflow' has no attribute 'placeholder' tensorflow2.0提示错误




问题本质:tf1.X版本升级到2.0以上出现的


为了让代码最快跑起来 最少的改动


不使用:
import tensorflow as tf


而用:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()






欢迎光临 东方耀AI技术分享 (http://www.ai111.vip/) Powered by Discuz! X3.4