tensorflow直接读取ckpt中的变量

ref:https://blog.csdn.net/u014365862/article/details/79397919

import tensorflow as tf
  
reader = tf.train.NewCheckpointReader("./model.ckpt")  
  
variables = reader.get_variable_to_shape_map()  
  
for v in variables: 
    w = reader.get_tensor(v)  
    print(type(w))  
    # print(w.shape) 
    # print (w[0]) 
    print(w)
原文地址:https://www.cnblogs.com/wioponsen/p/15061909.html