#参数恢复
self.sess=tf.Session()
saver = tf.train.import_meta_graph(os.path.join(model_fullpath,'model.ckpt-7.meta'))
module_file = tf.train.latest_checkpoint(model_fullpath)
saver.restore(self.sess, module_file)
variable_names = [v.name for v in tf.trainable_variables()]
variable_names = [v.name for v in tf.global_variables()]
values = self.sess.run(variable_names)
i=0
for k, v in zip(variable_names, values):
i+=1
if k.find('encode')!=-1:
print(f"第 {i} 个variable")
print("Variable: ", k)
print("Shape: ", v.shape)
print(v)
graph = tf.get_default_graph()
all_ops = graph.get_operations()
for el in all_ops:
print(el.name)
输出结果: