Decoding Output
Decode the model's outputs for training and inference.
We'll cover the following...
We'll cover the following...
Chapter Goals:
- Retrieve the decoder outputs and return the model's logits during training
After creating the decoder object for our model, we can perform the decoding using the decoder object as dynamic_decode
function.
Python 3.5
import tensorflow as tfextended_vocab_size = 500batch_size = 10# decoder is a BasicDecoder object used as Dynamic_decoderoutputs = decoder(inputs , initial_state=initial_state , sequence_length=input_seq_lens , training=True )decoder_output = outputs[0]logits = decoder_output.rnn_outputdecoder_final_state = outputs[1]decoded_sequence_lengths = outputs[2]