根据先前训练的模型Tensorflow进行预测

时间:2019-08-21 04:54:48

标签: python-3.x tensorflow keras

我已经使用张量流训练了回归模型。模型保存的文件,如

  1. model.ckpt-4000.meta
  2. model.ckpt-4000.index
  3. model.ckpt-4000.data-00001-of-00002

现在,如果我想使用这些文件来预测新数据集(测试数据)的输出值,我该怎么做?

1 个答案:

答案 0 :(得分:1)

sess=tf.Session()

#First load meta graph and restore weights

saver = tf.train.import_meta_graph('model.ckpt-4000.meta')
saver.restore(sess,tf.train.latest_checkpoint('./'))

# create feed-dict to feed new data and specify the y variable to be evaluated
sess.run(y,feed_dict)
相关问题