Tensorflow 的 API:seq2seq

Tensorflow's API: seq2seq

我一直在按照 https://github.com/kvfrans/twitch/blob/master/main.py 教程使用 tensorflow 创建和训练基于 rnn 的聊天机器人。据我了解,这些教程是在旧版本的 tensorflow 上编写的,所以有些部分已经过时并给我一个错误,如:

Traceback (most recent call last):
  File "main.py", line 33, in <module>
    outputs, last_state = tf.nn.seq2seq.rnn_decoder(inputs, initialstate, cell, loop_function=None, scope='rnnlm')
AttributeError: 'module' object has no attribute 'seq2seq'

我修复了其中的一些问题,但无法弄清楚 tf.nn.seq2seq.rnn_decoder 的替代方法是什么以及新模块的参数应该是什么。我目前修复的问题:

tf.nn.rnn_cell.BasicLSTMCell(embedsize)改为 tf.contrib.rnn.BasicLSTMCell(embedsize)

tf.nn.rnn_cell.DropoutWrapper(lstm_cell,keep_prob) 改为 tf.contrib.rnn.DropoutWrapper(lstm_cell,keep_prob)

tf.nn.rnn_cell.MultiRNNCell([lstm_cell] * numlayers)改为 tf.contrib.rnn.MultiRNNCell([lstm_cell] * numlayers)

有人可以帮我弄清楚 tf.nn.seq2seq.rnn_decoder 是什么吗?

我认为 this 是您需要的:

tf.contrib.legacy_seq2seq.rnn_decoder