I am using seq2seq below code, I found below error:
cell = tf.nn.rnn_cell.BasicLSTMCell(size)
a, b = tf.nn.dynamic_rnn(cell, seq_input, dtype=tf.float32)
cell_a = tf.contrib.rnn.OutputProjectionWrapper(cell, frame_dim)
dec_output= tf.contrib.legacy_seq2seq.rnn_decoder(seq_input, b, cell_a)
but I get the error:
TypeError: 'Tensor' object is not iterable.
I checked and it comes from seq2seq line.
Looks like seq_input
is a tensor, not a list of tensors. A single tensor works fine for tf.nn.dynamic_rnn
, but rnn_decoder
requires unstacking the sequence into a list of tensors:
decoder_inputs
: A list of 2D Tensors[batch_size x input_size]
.
In the source code, you can see that the implementation simply iterates over decoder_inputs
in a for
loop.