AttributeError: module ‘tensorflow._api.v2.train‘ has no attribute ‘NewCheckpointReader‘解决方案
tensorflow
一个面向所有人的开源机器学习框架
项目地址:https://gitcode.com/gh_mirrors/te/tensorflow

·
解决AttributeError: module ‘tensorflow._api.v2.train’ has no attribute ‘NewCheckpointReader’
问题描述:
TensorFlow版本是2.8.0,执行如下代码:
reader = tf.train.NewCheckpointReader(filename)
报错如下:
AttributeError: module 'tensorflow._api.v2.train' has no attribute 'NewCheckpointReader'
原因分析:
tensorflow
一个面向所有人的开源机器学习框架
项目地址:https://gitcode.com/gh_mirrors/te/tensorflow
TensorFlow 2.0以上的版本已经移除 tf.train.NewCheckpointReader
了。
解决方案:
用 tf.compat.v1.train.NewCheckpointReader
替换 tf.train.NewCheckpointReader
即可。
# reader = tf.train.NewCheckpointReader(filename)
reader = tf.compat.v1.train.NewCheckpointReader(filename)
如果代码多处因版本问题出现报错,可改换低版本的TensorFlow,用pip安装即可。
pip uninstall tensorflow
pip install tensorflow==1.14
推荐内容




一个面向所有人的开源机器学习框架
最近提交(Master分支:1 个月前 )
4f64a3d5
Instead, check for this case in `ResolveUsers` and `ResolveOperand`, by querying whether the `fused_expression_root` is part of the `HloFusionAdaptor`.
This prevents us from stepping into nested fusions.
PiperOrigin-RevId: 724311958
1 个月前
aa7e952e
Fix a bug in handling negative strides, and add a test case that exposes it.
We can have negative strides that are not just -1, e.g. with a combining
reshape.
PiperOrigin-RevId: 724293790
1 个月前
更多推荐
相关推荐
查看更多
tensorflow

一个面向所有人的开源机器学习框架
TensorFlow

Project containig related material for my TensorFlow articles
tensorflow

TensorFlow for R
热门开源项目
活动日历
查看更多
直播时间 2025-03-13 18:32:35

全栈自研企业级AI平台:Java核心技术×私有化部署实战
直播时间 2025-03-11 18:35:18

从0到1:Go IoT 开发平台的架构演进与生态蓝图
直播时间 2025-03-05 14:35:37

国产工作流引擎 终结「996」开发困局!
直播时间 2025-02-25 14:38:13

免费开源宝藏 ShopXO,电商系统搭建秘籍大公开!
直播时间 2025-02-18 14:31:04

从数据孤岛到数据智能 - 企业级数据管理利器深度解析
目录
所有评论(0)