Attention : seq2seq - penny4860/study-note GitHub Wiki
1. 정리
요약
- encoder의 모든 hs :
(T,128)
를 weighted averaging해서 context vector (128)
를 만든다.
- query : decoder의 h :
(128)
- values : encoder의 hs
- weight : query와 values의 내적
- 출력
- decoder의 h와 context vector를 concat해서 사용
질문
- Text Classification과 같은 과제에서는 attention을 어떻게 사용하나?
2. 내용
입력
- hs :
(T, 128)
- h :
(128,)
- decoder의 t시점에서의 hidden state
연산과정
- context vector 구하기
- 가중치 구하기
- hs와 h의 유사도
- hs
(T, 128)
와 h (128)
를 내적 & softmax
- w :
(T)
- context vector 구하기
- hs
(T, 128)
를 w (T)
에 따라 weighted average
- c :
(128)
- h, c를 concat