从训练好的tensorflow模型中打印训练变量实例
时间:2021-04-14 09:06:27|栏目:Python代码|点击: 次
从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]







