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

猜你喜欢

转载自www.cnblogs.com/liuyueyun/p/9225976.html