美文网首页
tensorflow查看checkpoint变量值

tensorflow查看checkpoint变量值

作者: 小啾Kris | 来源:发表于2019-08-29 14:58 被阅读0次
import tensorflow as tf

from tensorflow.python import pywrap_tensorflow

#使用tensorflow自带的pywrap_tensorflow读取模型

model_reader = pywrap_tensorflow.NewCheckpointReader(r"model.ckpt")

#变换成类似于dict形式的数据

var_dict = model_reader.get_variable_to_shape_map()

#最后,循环打印输出

for key in var_dict:

    print("variable name: ", key)

    print(model_reader.get_tensor(key))

相关文章

网友评论

      本文标题:tensorflow查看checkpoint变量值

      本文链接:https://www.haomeiwen.com/subject/cyyiectx.html