O'Reilly logo

Hands-On Natural Language Processing with Python by Rajalingappaa Shanmugamani, Rajesh Arumugam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Decoder network

The decoder network is also created with Gated Recurrent Unit (GRU) cells. The decoding_layer function takes the output of the encoder and the word embeddings of the English text as input. It produces an output projection vector of a size equal to the vocabulary size of the English text:

def decoding_layer(decoding_embed_inp, embeddings, encoding_op, encoding_st, v_size, fr_len,             en_len,max_en_len, rnn_cell_size, word2int, dropout_prob, batch_size, n_layers):    for l in range(n_layers):        with tf.variable_scope('dec_rnn_layer_{}'.format(l)):            gru = tf.contrib.rnn.GRUCell(rnn_len)            decoding_cell = tf.contrib.rnn.DropoutWrapper(gru,input_keep_prob = dropout_prob) out_l = Dense(v_size, kernel_initializer = tf.truncated_normal_initializer(mean ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required