Skip to content

Instantly share code, notes, and snippets.

@3h4
Created November 18, 2016 14:44
Show Gist options
  • Save 3h4/a353c663eebd0d2e7c64e9f97fa62aee to your computer and use it in GitHub Desktop.
Save 3h4/a353c663eebd0d2e7c64e9f97fa62aee to your computer and use it in GitHub Desktop.
# Forward pass
current_state = init_state
states_series = []
for current_input in inputs_series:
current_input = tf.reshape(current_input, [batch_size, 1])
input_and_state_concatenated = tf.concat(1, [current_input, current_state]) # Increasing number of columns
next_state = tf.tanh(tf.matmul(input_and_state_concatenated, W) + b) # Broadcasted addition
states_series.append(next_state)
current_state = next_state
@orian
Copy link

orian commented May 12, 2017

# Forward pass
current_state = init_state
states_series = []
for current_input in inputs_series:
    current_input = tf.reshape(current_input, [batch_size, 1])
    input_and_state_concatenated = tf.concat([current_input, current_state], 1)  # Increasing number of columns

    next_state = tf.tanh(tf.matmul(input_and_state_concatenated, W) + b)  # Broadcasted addition
    states_series.append(next_state)
    current_state = next_state

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment