简体   繁体   中英

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:

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. So how to set batch_size and step_size? Is that 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?

Or each sample have 20 features for 100 times, the dataset contains N samples : N * 100 *20?

For the 1st case, you should reshape 20 features as step_size*input_size.for example:

X.reshape(-1,4,5)

For the 2nd case

X.reshape(-1,100,20)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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