LSTM Decoder - beyondnlp/nlp GitHub Wiki

https://medium.com/deep-math-machine-learning-ai/chapter-10-1-deepnlp-lstm-long-short-term-memory-networks-with-math-21477f8e4235

LSTM diagram

LSTM equation

FORGATE GATE

INPUT GATE

OUTPUT GATE

CONTEXT

HIDDEN STATE

계산을 빠르고 효율적으로 하기 위해 wf-i-o-c * xt

  • 가중치와 입력인베딩에 대한 dot product를 계산한다.( 차원을 맞추기 위해 가중치를 전치(transpose)시킨다 )
  • Weight * inputEmbedding
  • forget, input, output, context 모두 inputEmbedding과 내적(dot product)를 해야 하는데 효율적(속도)으로 처리하기 위해
  • 하나의 matrix로 만들어서 한번에 처리한다.

uf-i-o-c * ht-1

  • 위에서와 동일하게 U에 대해서도 이전 hidden state output와 내적을 한다.

ot o tanh(Ct)

  • output gate와 tanh를 거친 Context를 요소별 곱셉( element wise product )를 실행한다.

it o tanh(c)

  • input gage와 tanh를 거친 context를 요소별 곱셉( element wise product )를 실행한다.

ft o Ct-1

  • forgate gate와 이전(t-1) context를 요소별 곱셉( element wise product )를 실행한다.

bf-i-o-c

  • 4개의 gate( forget, input, output, context )에 bias를 더한다.

activation