with tf.Session() as sess:
saver.restore(sess, './model_saved')
preds = []
X_batch = last_n_steps_value
X_batch = X_batch.reshape(-1, n_steps, 1)
for i in range(number_you_want_to_predict):
pred = sess.run(outputs, feed_dict={X: X_batch})
preds.append(pred.reshape(7)[-1])
X_batch = X_batch[:, 1:]
# Using predict value to replace real value
X_batch = np.append(X_batch, pred[:, -1])
X_batch = X_batch.reshape(-1, n_steps, 1)
在第一步中,您应该使用实际值。然后使用predict value替换最后一个值。 希望下面的代码能对您有所帮助。在
相关问题 更多 >
编程相关推荐