Tensorflow seq2seq `feed_previous' argument`

367 views Asked by At

I'm using the built-in tf.nn.seq2seq.embedding_attention_seq2seq() function and I have some problems with the feed_previous argument, during training, the groundtruth is fed into the decoder while during testing we feed the output of the last time step to the decoder. The problem is that once I set the feed_previous argument I can't change that argument. I want to test my model every epoch, what should I do?

1

There are 1 answers

0
Saurabh Saxena On

From the documentation, you can provide a boolean tensor for feed_previous.

feed_previous = tf.placeholder(tf.bool)
model = tf.nn.seq2seq.embedding_attention_seq2seq(..feed_previous=feed_previous...)
sess.run(loss, feed_dict={feed_previous=is_training, ...})