songyouwei / ABSA-PyTorch

Aspect Based Sentiment Analysis, PyTorch Implementations. 基于方面的情感分析,使用PyTorch实现。
MIT License
1.99k stars 522 forks source link

AEN_BERT question about s1_mean calcuation #192

Open Pager07 opened 3 years ago

Pager07 commented 3 years ago

Greetings author,

You calcuated s1_mean as follow

s1_mean = torch.div(torch.sum(s1, dim=1), context_len.view(context_len.size(0), 1))

I fail to understand why s1 of shape (bs,target_seq_len,d_model) is being divided by the length of the context. Why is it not divided by the length of the target?

Thank you. Sandeep