
正文
读取tensorflow的checkpoint里保存的参数
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
import tensorflow as tf
from tensorflow.python import pywrap_tensorflow
import os
checkpoint_path = '/home/lyy/titan3/gitclone/Unet-Tensorflow/model_output_20180619091248/checkpoint/model-9870' #通过saver保存的那个模型
reader = pywrap_tensorflow.NewCheckpointReader(checkpoint_path)
var_to_shape_map = reader.get_variable_to_shape_map()# Print tensor name and values
for key in var_to_shape_map:
print("tensor_name: ", key) #打印的key包括filter的参数回传的梯度
print(reader.get_tensor(key))



![【电子书】[科学技术] 《从机器学习到深度学习: 基于scikit-learn与TensorFlow的高效开发实战》[刘长龙][EPUB] 【电子书】[科学技术] 《从机器学习到深度学习: 基于scikit-learn与TensorFlow的高效开发实战》[刘长龙][EPUB]](https://www.04ip.com/template/qe/style/noimg/17.jpg)




