读取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))   

 

posted @ 2018-06-25 19:43  -小夭-  阅读(589)  评论(0编辑  收藏  举报