Skip to content

Instantly share code, notes, and snippets.

@mrubash1
Created March 22, 2017 22:49
Show Gist options
  • Save mrubash1/8fecc2e61125c107f6999a4fa80a45bd to your computer and use it in GitHub Desktop.
Save mrubash1/8fecc2e61125c107f6999a4fa80a45bd to your computer and use it in GitHub Desktop.
with tf.name_scope('lstm'):
# Forward direction cell:
lstm_fw_cell = tf.contrib.rnn.BasicLSTMCell(n_cell_dim, forget_bias=1.0, state_is_tuple=True)
# Backward direction cell:
lstm_bw_cell = tf.contrib.rnn.BasicLSTMCell(n_cell_dim, forget_bias=1.0, state_is_tuple=True)
# Now we feed `layer_3` into the LSTM BRNN cell and obtain the LSTM BRNN output.
outputs, output_states = tf.nn.bidirectional_dynamic_rnn(cell_fw=lstm_fw_cell,
cell_bw=lstm_bw_cell,
inputs=layer_3,
dtype=tf.float32,
time_major=True,
sequence_length=seq_length)
tf.summary.histogram("activations", outputs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment