본문 바로가기

STACKOVERFLOW 1일 1질문

What are nodes in RNN/LSTM, 노드가 뭐냐?

https://stats.stackexchange.com/questions/269996/what-are-nodes-in-rnn-lstm

 

What are nodes in RNN/LSTM?

In this blogpost "The Unreasonable Effectiveness of Recurrent Neural Networks" the author says, that he is training "a 2-layer LSTM with 512 hidden nodes" for character prediction. So it will look

stats.stackexchange.com

 

For fully-connected layers, the number of 'nodes' is the output dimension of the weight matrix. In other words, if we have a hidden layer, where:

  • input layer, dimension di
  • hidden layer 1, dimension dh

Fully-connected layers에서 node의 수는 출력 가중치 행렬의 차원을 말한다. input layer의 차원은 di이고 hidden layer의 차원은 dh가 된다.

 

 

 

... then the weight matrix for hidden layer 1 will be di×dhdi×dh. 

dh in this case is the number of 'nodes' of hidden layer 1, it is the output dimension.

 

 

그렇기 때문에 숨겨진 레이어의 가중치 행렬은 di * dh가 될 것이다.

이때의 dh는 숨겨진 레이어 1의 노드의 수가 되며, 곧 출력의 차원이 된다.

 

 

In RNNs and LSTMs, these concepts are unchanged.

However, nuance: there is an embedding layer in the input and the output, for RNNs, in general. So, the layers are like this:

 

RNN과 LSTM에서 이런 개념은 바뀌지 않는다.

하지만, 일반적으로 RNN에서는 embedding layer가 있다.

 

 

  • input layer, dimension di (corresponds to the one-hot dimension)
  • embedding layer, dimension dh (embeds the one-hot vector into embedding dimension dhdh; generally this is just a matrix multiplication)
  • LSTM, dimension dh (contains various dh×dh matrices)
  • output embedding, dimension do (in char-rnn, do=dido=di, it decodes from the output embedding vectors, back into a probabilitiy distribution over possible characters)

인풋 레이어, di(웟한 벡터의 차원에 대응되며)

임베딩 레이어, dh(원핫 벡터가 임베딩 벡터 dh로 변하며, 임베딩 모델을 곱함으로써 이루어진다)

LSTM 레이어, dh( 다양한 dh*dh 행렬을 가지고 있다)

아웃풋 임베딩 레이어, do(문자 RNN에서는 인풋과 아웃풋의 차원이 같다. 아웃풋 임베딩 벡터로 나와 확률 형태로 각 문자에 뿌려진다)