2
我在神经网络的张量流中创建了模型。 我保存了模型并将它恢复到另一个python文件中。张量流和预测中的恢复模型
的代码如下:
def restoreModel():
prediction = neuralNetworkModel(x)
tf_p = tensorFlow.nn.softmax(prediction)
temp = np.array([2,1,541,161124,3,3])
temp = np.vstack(temp)
with tensorFlow.Session() as sess:
new_saver = tensorFlow.train.import_meta_graph('model.ckpt.meta')
new_saver.restore(sess, tensorFlow.train.latest_checkpoint('./'))
all_vars = tensorFlow.trainable_variables()
tensorFlow.initialize_all_variables().run()
sess.run(tensorFlow.initialize_all_variables())
predict = sess.run([tf_p], feed_dict={
tensorFlow.transpose(x): temp,
y : ***
})
当我想预测 “TEMP” 变量! X是矢量形状,我“转置”它以匹配形状。 我不明白我需要在feed_dict
变量中写什么。