【发布时间】:2016-10-08 10:35:18
【问题描述】:
我尝试运行这段代码:
outputs, states = rnn.rnn(lstm_cell, x, initial_state=initial_state, sequence_length=real_length)
tensor_shape = outputs.get_shape()
for step_index in range(tensor_shape[0]):
word_index = self.x[:, step_index]
word_index = tf.reshape(word_index, [-1,1])
index_weight = tf.gather(word_weight, word_index)
outputs[step_index, :, :]=tf.mul(outputs[step_index, :, :] , index_weight)
但我在最后一行得到错误:
TypeError: 'Tensor' object does not support item assignment
似乎我无法分配给张量,我该如何解决?
【问题讨论】:
标签: python tensorflow