Tensorflow seq2seq:Tensor';对象是不可编辑的
我正在使用下面的seq2seq代码,我发现以下错误:Tensorflow seq2seq:Tensor';对象是不可编辑的,tensorflow,machine-learning,lstm,recurrent-neural-network,sequence-to-sequence,Tensorflow,Machine Learning,Lstm,Recurrent Neural Network,Sequence To Sequence,我正在使用下面的seq2seq代码,我发现以下错误: 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_in
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)
但我得到了一个错误:
TypeError: 'Tensor' object is not iterable.
我检查了一下,它来自seq2seq行。看起来像是
seq\u input
是一个张量,而不是张量列表。单个张量适用于tf.nn.dynamic\u rnn
,但需要将序列拆分为张量列表:
解码器输入
:2D张量列表[批量大小x输入大小]
在中,您可以看到实现只是在for
循环中对解码器输入进行迭代