东方耀AI技术分享

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 1773|回复: 0
打印 上一主题 下一主题

[课堂笔记] module 'tensorflow' has no attribute 'placeholder' tensorflow2.0提示错误

[复制链接]

1365

主题

1856

帖子

1万

积分

管理员

Rank: 10Rank: 10Rank: 10

积分
14437
QQ
跳转到指定楼层
楼主
发表于 2021-5-10 09:07:00 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式




诸如此类报错:
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()

tf2.0.png (28.18 KB, 下载次数: 146)

tf2.0.png
让天下人人学会人工智能!人工智能的前景一片大好!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|人工智能工程师的摇篮 ( 湘ICP备2020019608号-1 )

GMT+8, 2024-5-6 05:31 , Processed in 0.186436 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表