简体   繁体   English

如何在TensorFlow RNN中提供数据?

[英]how to feed data in TensorFlow RNN?

Here is my data format: 100x20, 20 feature and 100 rows, and this is the tensorflow RNN input data format: 这是我的数据格式:100x20、20个要素和100行,这是tensorflow RNN输入数据格式:

x = tf.placeholder(tf.float32, [batch_size, step_size, input_size], name='input_placeholder')

I know input_size=20, I want Truncated Backpropagation is n step, and feed one rows once. 我知道input_size = 20,我希望截断的反向传播为n步,并一次喂入一行。 So how to set batch_size and step_size? 那么如何设置batch_size和step_size? Is that step_size=n? 那是step_size = n吗?

Thanks for your answer. 感谢您的回答。

I am not clear what your data is. 我不清楚您的数据是什么。 Do you mean,it is 100 rows,each row for a sample with 20 features? 您是说100行,每行20个要素的样本?

Or each sample have 20 features for 100 times, the dataset contains N samples : N * 100 *20? 还是每个样本有20个特征进行100次,数据集包含N个样本:N * 100 * 20?

For the 1st case, you should reshape 20 features as step_size*input_size.for example: 对于第一种情况,应将20个要素重塑为step_size * input_size。例如:

X.reshape(-1,4,5)

For the 2nd case 对于第二种情况

X.reshape(-1,100,20)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM