3

When I am reading the seq2seq tutorial here, I can't understand the output of function tf.contrib.seq2seq.dynamic_docode.

The tutorial access the output the decoder used in training with sample_id = outputs.sample_idand logits = self.output_layer(outputs.rnn_output)while in the inference, logits = outputs.rnn_outputand sample_id = outputs.sample_id. What does the logits and sample_id represent here? What is the content of the final_outputs of function tf.contrib.seq2seq.dynamic_docode?

lifang
  • 1,485
  • 3
  • 16
  • 23

1 Answers1

6

Okay, sorry for such a naive question. Figured it out from here. So the outputs of tf.contrib.seq2seq.BasicDecoder is an instance of class BasicDecoderOutput(rnn_output, sample_id). I think the official document should have given this information.

And in more detail:

rnn_output is the output of the decoding cell.

sample_id is the id returned by a Helper. For GreedyEmbeddingHelper, the sample_id is argmax(outputs, axis=-1, output_type=dtypes.int32). And sample_id in the outputs of tf.contrib.seq2seq.BasicDecoder should be of shape [num_timesteps] if GreedyEmbeddingHelperis used.

lifang
  • 1,485
  • 3
  • 16
  • 23