转载:https://blog.csdn.net/aiseu001/article/details/79851176
从tensorflow 训练后保存的模型中打印训变量:使用tf.train.NewCheckpointReader()
-
import tensorflow as tf
-
reader = tf.train.NewCheckpointReader('path/alexnet/model-330000')
-
dic = reader.get_variable_to_shape_map()
-
print dic
打印变量
-
w = reader.get_tensor("fc1/W")
-
print type(w)
-
print w.shape
-
print w[0]