Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get max attentive context correctly #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kch31411
Copy link

@kch31411 kch31411 commented Aug 9, 2019

논문의 내용과 다르게 구현된 부분이 있는 것 같아 PR 합니다.

@galsang
Copy link
Owner

galsang commented Aug 12, 2019

제가 코드를 짠 지 오래 돼서 어떤 점이 잘못됐는지 설명해주시면 감사하겠습니다.

@kch31411
Copy link
Author

kch31411 commented Aug 17, 2019

기존 코드는 attention이 곱해진 context(ex. att_h_fw)들 중에서

att_h_fw = con_h_fw.unsqueeze(1) * att_fw.unsqueeze(3)

element-wise하게 가장 큰 값들을 골라 뽑는 것으로 보입니다.

att_max_h_fw, _ = att_h_fw.max(dim=2)

그러나 원 논문에서 의도된 Max attentive context는 가장 큰 attention 값을 가지는 context 벡터를 뽑아오는 것으로 되어있습니다.
"we pick the contextual embedding with the highest cosine similarity as the attentive vector"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants