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

麻烦问下这里是什么意思,谢谢! #2

Open
alwayslikethat opened this issue Nov 27, 2021 · 1 comment
Open

麻烦问下这里是什么意思,谢谢! #2

alwayslikethat opened this issue Nov 27, 2021 · 1 comment

Comments

@alwayslikethat
Copy link

    for i in range(BATCH_SIZE):
        s_len = seqlen_1d[i]
        mask[i, 0:s_len] = 1
    mask = torch.FloatTensor(mask).to(self.device)
@ll0ruc
Copy link
Owner

ll0ruc commented Nov 28, 2021

@alwayslikethat
generate sentence mask, get its final feature representation according to the actual length of sentence
refer to line 60 in model.py
xx_m = torch.mul(xx, mask.unsqueeze(2)

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

No branches or pull requests

2 participants