Created
December 6, 2018 22:57
-
-
Save hadifar/8c2cfc7eed355dde33eecf894fe99635 to your computer and use it in GitHub Desktop.
This file contains 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
hidden_states = tf.scan(fn=rnn_step, | |
elems=tf.transpose(embed, perm=[1, 0, 2]), # change batch_size*seq_len*dim --> seq_len*batch_size*dim | |
initializer=tf.zeros([batch_size, rnn_size])) | |
outputs = tf.transpose(hidden_states, perm=[1, 0, 2]) # convert to original shape --> batch_size*seq_len*dim | |
last_rnn_output = outputs[:, -1, :] # extract last output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment