1

I have some very basic lstm code with tensorflow and python, where my code is

output = tf.nn.rnn(tf.nn.rnn_cell.BasicLSTMCell(10), input_flattened, initial_state=tf.placeholder("float", [None, 20]))

where my input flattened is shape [?, 5, 22501]

I'm getting the error TypeError: inputs must be a sequence on the state parameter of the lstm, and I'm ripping my hair out trying to find out why it is giving me this error. Any help would be greatly appreciated.

Alt
  • 2,597
  • 5
  • 26
  • 36
agupta231
  • 1,161
  • 2
  • 14
  • 24

1 Answers1

4

I think when you use the tf.nn.rnn function it is expecting a list of tensors and not just a single tensor. You should unpack input in the time direction so that it is a list of tensors of shape [?, 22501]. You could also use tf.nn.dynamic_rnn which I think can handle this unpack for you.

chasep255
  • 11,745
  • 8
  • 58
  • 115