发布时间:2022-08-19 12:20
博客首页:knighthood2001
欢迎点赞评论️
❤️ 热爱python,期待与大家一同进步成长!!❤️
给大家推荐一款很火爆的刷题、面试求职网站
利用以下代码获取输出节点的检查点模型名称。
from tensorflow.python import pywrap_tensorflow
checkpoint_path = r'E:\crack\models_trainning\my_model\ckpt-2'
reader = pywrap_tensorflow.NewCheckpointReader(checkpoint_path)
var_to_shape_map = reader.get_variable_to_shape_map()
for key in var_to_shape_map:
print("tensor_name: ", key)
不过出现了以下错误
Traceback (most recent call last):
File "C:/Users/knighthood/OneDrive/桌面/tensorflow_ckpt_2_pb-master/tensorflow_ckpt_2_pb-master/view_ckpt_graph.py", line 6, in
reader = pywrap_tensorflow.NewCheckpointReader(checkpoint_path)
AttributeError: module 'tensorflow.python.pywrap_tensorflow' has no attribute 'NewCheckpointReader'
即
module 'tensorflow.python.pywrap_tensorflow' has no attribute 'NewCheckpointReader'
原因:由于tensorflow版本有1.和2.的区别,以上只适用于tensorflow 1.的版本,争对tensorflow 2.的版本,可以使用如下代码
import tensorflow.compat.v1 as tf1
tf1.disable_v2_behavior()
checkpoint_path = r'E:\crack\models_trainning\my_model\ckpt-2'
# Read data from checkpoint file
reader = tf1.train.NewCheckpointReader(checkpoint_path)
var_to_shape_map = reader.get_variable_to_shape_map()
for key in var_to_shape_map:
print("tensor_name: ", key)
【React】一文搞懂路由组件传参(三种方案params、search、state)
mycat实现mysql数据库读写分离_Mycat实现MySQL读写分离
列表容器&事件链如何帮业务提升发版迭代效率? | DX研发模式
openharmony北向应用开发实例之HelloWorld
逼真度超越「AI设计师」DALL·E 2!谷歌大脑推出新的文本生成图像模型——Imagen...
Java开发学习(十三)----基于注解开发定义第三方bean及注解开发总结
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the
Vue+Echarts监控大屏实例七:智慧养老监控模板实例下