其他分享
首页 > 其他分享> > tensorflow训练好的模型怎么调用?

tensorflow训练好的模型怎么调用?

作者:互联网

原文链接

保存训练好的模型的代码如下:

sess = tf.Session()
saver = tf.train.Saver()
model_path = "D:\sample\model.ckpt"
save_path = saver.save(sess, model_path)

使用时,代码如下:

saver = tf.train.Saver()
saver.restore(sess, "D:\sample\model.ckpt")
result = sess.run(y, feed_dict={x: data})

y即为输出的结果

 

 

标签:sess,调用,模型,sample,path,tf,tensorflow,model,saver
来源: https://www.cnblogs.com/tiho/p/12575895.html