Search code examples
pythontensorflowrecurrent-neural-networksequence-to-sequenceencoder-decoder

How to build a decoder using dynamic rnn in Tensorflow?


I know how to build an encoder using dynamic rnn in Tensorflow, but my question is how can we use it for decoder? Because in decoder at each time step we should feed the prediction of previous time step. Thanks in advance!


Solution

  • If for example, you are using Tensorflow's attention_decoder method, pass a parameter "loop_function" to your decoder. Google search for "extract_argmax_and_embed", that is your loop function.