Created
February 6, 2019 05:42
-
-
Save HarshSingh16/d3f56fb1f46b9a4ca4bdc704fb16f3ae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Building the seq2seq model | |
def seq2seq_model(inputs, targets, keep_prob, batch_size, sequence_length, answers_num_words, questions_num_words, encoder_embedding_size, decoder_embedding_size, rnn_size, num_layers, questionswords2int): | |
encoder_embedded_input = tf.contrib.layers.embed_sequence(inputs, | |
answers_num_words + 1, | |
encoder_embedding_size, | |
initializer = tf.random_uniform_initializer(0, 1)) | |
encoder_state = encoder_rnn(encoder_embedded_input, rnn_size, num_layers, keep_prob, sequence_length) | |
preprocessed_targets = preprocess_targets(targets, questionswords2int, batch_size) | |
decoder_embeddings_matrix = tf.Variable(tf.random_uniform([questions_num_words + 1, decoder_embedding_size], 0, 1)) | |
decoder_embedded_input = tf.nn.embedding_lookup(decoder_embeddings_matrix, preprocessed_targets) | |
training_predictions, test_predictions = decoder_rnn(decoder_embedded_input, | |
decoder_embeddings_matrix, | |
encoder_state, | |
questions_num_words, | |
sequence_length, | |
rnn_size, | |
num_layers, | |
questionswords2int, | |
keep_prob, | |
batch_size) | |
return training_predictions, test_predictions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment