值误差和张量流馈送

时间:2018-07-29 10:38:22

标签: python tensorflow

ValueError :无法为形状为((28,7,22))的张量'占位符:0'输入形状(942,22)的值

谁能告诉我应该如何在basicRNN单元中提供数据?以下是tensorflow代码的一部分。

num_inputs = 22

timesteps = 7

batch_size = 28

x=tf.placeholder(tf.float32,shape=(batch_size,timesteps,num_inputs))
y=tf.placeholder(tf.float32,shape=(batch_size,timesteps,num_outputs))

with tf.Session(config= tf.ConfigProto(gpu_options=gpu_options)) as sess:
    sess.run(init)

for iteration in range(num_iterations):
    sess.run(train,feed_dict={x:X_train,y:y_train} )        
    if iteration % 100==0:
       mse=loss.eval(feed_dict={x:X_train,y:y_train})
       print(mse)

saver.save(sess,"./rnn_model") 

0 个答案:

没有答案