简体   繁体   中英

Tensorflow's API: seq2seq

I have been following https://github.com/kvfrans/twitch/blob/master/main.py tutorial to create and train a chatbot based on rnn using tensorflow. From what I understand, the tutorials was written on an older version of tensorflow, so some parts are outdated and give me an error like:

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'

I fixed some of them, but can't figure out what is the alternative to tf.nn.seq2seq.rnn_decoder and what should be the new module's parameters. What I currently fixed:

tf.nn.rnn_cell.BasicLSTMCell(embedsize) changed to tf.contrib.rnn.BasicLSTMCell(embedsize)

tf.nn.rnn_cell.DropoutWrapper(lstm_cell,keep_prob) changed to tf.contrib.rnn.DropoutWrapper(lstm_cell,keep_prob)

tf.nn.rnn_cell.MultiRNNCell([lstm_cell] * numlayers) changed to tf.contrib.rnn.MultiRNNCell([lstm_cell] * numlayers)

Can someone please help me figure out what tf.nn.seq2seq.rnn_decoder will be?

我认为是你需要的:

tf.contrib.legacy_seq2seq.rnn_decoder

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM