Skip to content

Instantly share code, notes, and snippets.

@Blaizzy
Last active September 12, 2019 16:09
Show Gist options
  • Select an option

  • Save Blaizzy/a9914b663b436dff0a611eabdaca169f to your computer and use it in GitHub Desktop.

Select an option

Save Blaizzy/a9914b663b436dff0a611eabdaca169f to your computer and use it in GitHub Desktop.
# LSTM archicture Pseudocode
# Part 1/2
output_t = np.tanh(np.dot(input_t, self.Wo) + np.dot(state_t, self.Uo) + np.dot(C_t, self.Vo) + self.bo)
i_f = sigmoid(np.dot(input_t, self.Wi) + np.dot(state_t, self.Ui) + self.bi)
f_t = sigmoid(np.dot(input_t, self.Wf) + np.dot(state_t, self.Uf) + self.bf)
k_t = sigmoid(np.dot(input_t, self.Wk) + np.dot(state_t, self.Uk) + self.bk)
# You obtain the new carry state by combining i_t, f_t and k_t.
# Part 2/2
C_t = i_f * k_t + C_t * f_t
state_t = output_t * np.tanh(C_t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment