TF:利用TF的train.Saver将训练好的variables(W、b)保存到指定的index、meda文件—Jason niu

import tensorflow as tf
import numpy as np

W = tf.Variable([[2,1,8],[1,2,5]], dtype=tf.float32, name='weights')
b = tf.Variable([[1,2,5]], dtype=tf.float32, name='biases')
  
init= tf.global_variables_initializer()  
  
saver = tf.train.Saver()     
  
with tf.Session() as sess:   
    sess.run(init)
    save_path = saver.save(sess, "niu/save_net.ckpt") 
    print("Save to path: ", save_path)       

 

posted @ 2018-01-25 22:05  一个处女座的程序猿  阅读(192)  评论(0编辑  收藏  举报