简体   繁体   English

Tensorflow的API:seq2seq

[英]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. 我一直在关注https://github.com/kvfrans/twitch/blob/master/main.py教程,使用tensorflow创建和训练基于rnn的聊天机器人。 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: 根据我的理解,这些教程是在较旧版本的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'

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. 我修复了其中一些,但无法弄清楚tf.nn.seq2seq.rnn_decoder的替代方法是什么,以及新模块的参数应该是什么。 What I currently fixed: 我目前修正的内容:

tf.nn.rnn_cell.BasicLSTMCell(embedsize) changed to tf.contrib.rnn.BasicLSTMCell(embedsize) tf.nn.rnn_cell.BasicLSTMCell(embedsize)更改为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.DropoutWrapper(lstm_cell,keep_prob)更改为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) tf.nn.rnn_cell.MultiRNNCell([lstm_cell] * numlayers)更改为tf.contrib.rnn.MultiRNNCell([lstm_cell] * numlayers)

Can someone please help me figure out what tf.nn.seq2seq.rnn_decoder will be? 有人可以帮我弄清楚tf.nn.seq2seq.rnn_decoder会是什么?

我认为是你需要的:

tf.contrib.legacy_seq2seq.rnn_decoder

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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